<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Olmos JT on Medium]]></title>
        <description><![CDATA[Stories by Olmos JT on Medium]]></description>
        <link>https://medium.com/@olmosJT?source=rss-d04feedd75e7------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*jZimnqgNxnO-Y7RaXKeXdw.jpeg</url>
            <title>Stories by Olmos JT on Medium</title>
            <link>https://medium.com/@olmosJT?source=rss-d04feedd75e7------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 28 Nov 2026 15:41:47 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@olmosJT/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[ From Beans To Scenes #1: Installing Unity & Getting Started with Game Development]]></title>
            <link>https://medium.com/@olmosJT/from-beans-to-scenes-1-installing-unity-getting-started-with-game-development-2848cd1931dc?source=rss-d04feedd75e7------2</link>
            <guid isPermaLink="false">https://medium.com/p/2848cd1931dc</guid>
            <category><![CDATA[unity-game-development]]></category>
            <category><![CDATA[unity]]></category>
            <dc:creator><![CDATA[Olmos JT]]></dc:creator>
            <pubDate>Thu, 13 Nov 2025 10:44:06 GMT</pubDate>
            <atom:updated>2025-11-13T10:44:06.821Z</atom:updated>
            <content:encoded><![CDATA[<p>Okay. Let’s talk about this.</p><p>I‘m a Spring Boot developer. I live in pom.xml and build.gradle files. I live in IntelliJ. My world is services, repositories, modules, DDD, SAGA, and dreaded YAML configs.</p><p>It’s logical. It’s (mostly) predictable.</p><p>Then there’s this. Game development.</p><p>I’m an apprentice here. A rookie. I’ve spent my nights trying to figure this out, and the first boss battle isn’t a dragon.</p><p>It’s the installer.</p><p>I’m sharing this now because I just figured it out, and the confusion is still fresh. If you’re like me, you don’t need an expert. You need someone who just survived the trenches.</p><p>So let’s do this. Stop watching “What is Unity?” videos. Stop planning your epic 100-hour open-world RPG.</p><p>Let’s just open the program.</p><blockquote>What Program?</blockquote><h3><strong>Step 1: The Thing that Installs the Thing 😁</strong></h3><p>My first mistake? I searched for <strong>“Download Unity”</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*G4ukeieKRxyZzOolMtQBCw.png" /></figure><p>Wrong.</p><p>You don’t download Unity. You download <strong>Unity Hub</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/752/1*rjLiRsV1d2AUQ_yxMlRa9g.png" /></figure><p>This was my first “Oh.” This is the mission control. It’s like a package manager (think Maven, but with a GUI) for the entire engine. It handles all your different versions and all your projects.</p><p>Yes, versions. Plural. You will end up with more than one. Don’t ask why. Just accept it.</p><p><strong>Go. Download Unity Hub.</strong></p><p><strong>Install it. Open it.</strong></p><p>I don’t know how you will install but I use Linux: So what I did was just type commands on terminal.</p><pre>flatpak install flathub com.unity.UnityHub</pre><p>It’s going to ask you to sign in or create an account. Do it. This is how you get your license. (<a href="https://login.unity.com/en/sign-in">https://login.unity.com/en/sign-in</a>)</p><p>Don’t panic. You want the <strong>Personal</strong> license. It’s free.</p><p>Free is good.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/924/1*SVkFfq2P47Z6YNLohPw4TQ.png" /></figure><h3>Step 2: Which Button Do I Press?</h3><p>You’re in the Hub. It’s empty. It feels… judgmental.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*oUgGlwnrchBzW9GiMM4GRg.png" /></figure><p>You’ll see an “Installs” tab. Click it.</p><p>Click “Install Editor.”</p><p>A list pops up. “2023.x,” “2022.x (LTS),” “2021.x (LTS),”… alphas, betas…</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FkPoDPoP8DbOT-hoF8uXXw.png" /></figure><p>My developer brain spiked. What’s the difference? Which one is stable? Am I downloading the right thing?</p><p>Here’s the answer I wish someone gave me:</p><p><strong>Just pick the newest one that says (LTS).</strong></p><p>LTS stands for <strong>Long Term Support</strong>. In Spring terms, it’s the one that’s not going to break in weird, spectacular ways. It’s the “stable” build.</p><p>Don’t be a hero. Don’t grab the shiny new Beta. You don’t need that pain. Not yet.</p><h3>Step 3: The “Are You Sure?” Checklist</h3><p>You click “Install,” and another window pops up. “Modules.”</p><p>This is where I <em>really</em> got stuck.</p><p>It’s a giant checklist of every platform known to man. Android, iOS, Windows, Linux, WebGL, tvOS…</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1020/1*bSLeA0fLmOS2Wmtl0MSksw.png" /></figure><p>My brain: <em>Do I need all of them? What if I want to build for a smart-fridge one day?</em></p><p>Stop.</p><p>You are not building for a smart-fridge today.</p><p>You are building for your computer. That’s it.</p><p>Here is what you <em>actually</em> need:</p><ul><li><strong>Microsoft Visual Studio Community</strong> (If you’re on Windows. It’s the code editor. It’ll auto-select.) Or Rider.</li><li><strong>Mac Build Support</strong> (If you’re on Mac.)</li><li><strong>WebGL Build Support</strong> (This one is cool. It lets you build for a web browser. Good for sharing.)</li></ul><p>That’s it.</p><p>Don’t click Android. Don’t click iOS. Not yet.</p><p>Why? Because every module is <em>gigs</em>. Giga. Bytes. You can <em>always</em> add them later. Click a button, go get coffee.</p><p>Don’t bloat your machine on day one.</p><p>Click “Install.”</p><h3>Step 4: The Actual First Step</h3><p>Now you wait. It’s a big download.</p><p>This is the part where the doubt creeps in. “This is complicated. Maybe I’m not cut out for this.”</p><p>It’s an installer. Not a final exam. You’re doing fine.</p><p>…Done?</p><p>Good.</p><p>Now go to the “Projects” tab. Click “New Project.”</p><p>You’ll see templates: 2D, 3D, URP, HDRP… more acronyms.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ikf4j1qECDpkrpsxLKYOtA.png" /></figure><p>Ignore them all.</p><p>Just select <strong>3D</strong> (or 2D, if that’s your dream).</p><p>Give it a name. “MyFirstProject.” “Test.” “DeleteMeLater.” Whatever.</p><p>Click “Create Project.”</p><p>It will… wait. For a long time. It’s importing… things.</p><p>Don’t touch it.</p><p>Finally, a window will open. A grey abyss with four small sub-windows and about one million buttons.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6ElmX_Wa7sngqoq5nkJebQ.png" /></figure><p>You’re in.</p><p>You’ve done it. You installed Unity. You’re officially a game developer.</p><p>…a very, very confused game developer.</p><p>That’s okay. Me too.</p><p>Next time, we’ll try to figure out what a “GameObject” is. For now, just sit back.</p><p>You started.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2848cd1931dc" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[ Spring Boot Daily Tip #2: Your @Transactional Is Doing Nothing]]></title>
            <link>https://medium.com/@olmosJT/spring-boot-daily-tip-2-your-transactional-is-doing-nothing-1984f6667e57?source=rss-d04feedd75e7------2</link>
            <guid isPermaLink="false">https://medium.com/p/1984f6667e57</guid>
            <category><![CDATA[spring]]></category>
            <category><![CDATA[spring-boot]]></category>
            <category><![CDATA[transactional]]></category>
            <category><![CDATA[database]]></category>
            <category><![CDATA[annotations]]></category>
            <dc:creator><![CDATA[Olmos JT]]></dc:creator>
            <pubDate>Tue, 04 Nov 2025 13:07:04 GMT</pubDate>
            <atom:updated>2025-11-04T13:07:04.905Z</atom:updated>
            <content:encoded><![CDATA[<p>Let’s be honest. You’re using @Transactional and half the time you have no idea why it&#39;s not working.</p><p>You’ve written this exact code. And it’s a time bomb.</p><p>You have a service. It has a big, public “entry” method. Inside, you call a “helper” method. You want that helper to run in its <em>own</em> transaction, so you get clever.</p><p><strong>The Code You Wrote (It’s a Trap):</strong></p><pre>@Service<br>public class MyBrokenService {<br>    <br>    @Autowired<br>    private MyRepo myRepo;<br><br>    // This is your main &quot;entry&quot; method<br>    public void createBigThing(Data data) {<br>        System.out.println(&quot;--- createBigThing: Transaction? No. ---&quot;);<br>        <br>        // ... some complex logic ...<br>        <br>        // AND THIS IS THE TRAP<br>        // You&#39;re calling your *own* method using &#39;this&#39;<br>        this.saveSmallThing(data); <br>        <br>        // You throw an exception, expecting... something?<br>        if (data.isBad()) {<br>            throw new RuntimeException(&quot;Rollback, please!&quot;);<br>        }<br>    }<br><br>    // You think this is running in a new, independent transaction.<br>    // It is NOT.<br>    @Transactional(propagation = Propagation.REQUIRES_NEW)<br>    public void saveSmallThing(Data data) {<br>        System.out.println(&quot;--- saveSmallThing: Transaction? Still No. ---&quot;);<br>        myRepo.save(data);<br>    }<br>}</pre><p>You run this. The createBigThing method throws its &quot;Rollback, please!&quot; exception.</p><p>And you check your database.</p><p>The saveSmallThing data is still there. It didn&#39;t roll back. Or maybe it didn&#39;t commit when you thought it would. It&#39;s a mess.</p><p>You just corrupted your database. Congratulations.</p><h3>💥 The “Gotcha”: You’re Calling keyword — &#39;this’. You&#39;re Bypassing Spring.</h3><p>This isn’t a Spring bug. This is you fundamentally misunderstanding how Spring works.</p><p>You think Spring is magic. It’s not. It’s <strong>proxies</strong>.</p><p>Spring AOP (for @Transactional, @Async, @Cacheable) works by <strong>wrapping your bean in a proxy object.</strong></p><ol><li>When <em>another bean</em> (like a Controller) calls myBrokenService.saveSmallThing(), it&#39;s <strong>not</strong> talking to your class. It&#39;s talking to the <strong>proxy</strong>.</li><li>The proxy sees @Transactional. It intercepts the call. It starts a transaction. <em>Then</em> it calls your real method.</li><li>When <em>you</em> call this.saveSmallThing() from <em>inside</em> MyBrokenService, you are not talking to the proxy. You are just calling a <strong>plain Java method</strong> on your <strong>plain Java object</strong>.</li><li><strong>There is no proxy. There is no interceptor. There is no transaction.</strong></li></ol><p>You’re calling yourself. You’re bypassing all of Spring’s magic.</p><h3>How to Fix This Mess</h3><p>You have two options. The hack, and the right way.</p><p><strong>1. The Ugly Hack (Don’t do this, but you will)</strong></p><p>You can inject the service <em>into itself</em>. I’m not kidding.</p><pre>@Service<br>public class MyFixedService {<br>    @Autowired<br>    private MyRepo myRepo;<br>    <br>    // UGLY, but it works<br>    @Autowired<br>    private MyFixedService self; // Inject the proxy of itself<br><br>     public void createBigThing(Data data) {<br>        // ... some complex logic ...<br>        <br>        // Now you call the PROXY, not &#39;this&#39;<br>        self.saveSmallThing(data); <br>        <br>        if (data.isBad()) {<br>            throw new RuntimeException(&quot;Rollback, please!&quot;);<br>        }<br>    }<br><br><br>    @Transactional(propagation = Propagation.REQUIRES_NEW)<br>    public void saveSmallThing(Data data) {<br>        myRepo.save(data);<br>    }<br>}</pre><p>This works because self holds the <em>proxy object</em>, not the this reference. When you call self.saveSmallThing(), you&#39;re going through the front door, and the proxy can finally do its job. It&#39;s a hack, but it&#39;s a &quot;Spring-aware&quot; hack.</p><p><strong>2. The <em>Real</em> Fix (Stop being lazy and design it right)</strong></p><p>It’s not one service. It’s two. You have two different jobs, so you make two different classes.</p><p><strong>Service A: The Helper</strong></p><pre>@Service<br>public class SmallThingService {<br>    @Autowired<br>    private MyRepo myRepo;<br><br>    @Transactional(propagation = Propagation.REQUIRES_NEW)<br>    public void saveSmallThing(Data data) {<br>        System.out.println(&quot;--- SmallThingService: NEW transaction starts ---&quot;);<br>        myRepo.save(data);<br>        System.out.println(&quot;--- SmallThingService: NEW transaction commits ---&quot;);<br>    }<br>}</pre><p><strong>Service B: The Orchestrator</strong></p><pre>@Service<br>public class BigThingService {<br>    @Autowired<br>    private SmallThingService smallThingService; // Inject the *other* service<br><br>    public void createBigThing(Data data) {<br>        System.out.println(&quot;--- BigThingService: No transaction here ---&quot;);<br>        <br>        // ... complex logic ...<br>        <br>        // NOW IT WORKS. You&#39;re calling the proxy of &#39;SmallThingService&#39;.<br>        smallThingService.saveSmallThing(data); <br>        <br>        if (data.isBad()) {<br>            throw new RuntimeException(&quot;Exception after small save!&quot;);<br>        }<br>    }<br>}</pre><p>This is clean. It’s obvious. The BigThingService calls the SmallThingService. The call is intercepted by the proxy. The transaction works. The world makes sense.</p><h3>The Real Question: “Where Do I Put the Damn Annotation?”</h3><p>This is the most important part. You don’t just throw @Transactional at the wall. You <em>design</em> your transaction.</p><p>Let’s use the <strong>real fix</strong> (two services) to see the two main patterns.</p><h4>🎯 Scenario 1: The All-or-Nothing (The Standard)</h4><p>You want <em>everything</em> to pass, or <em>everything</em> to fail.</p><pre>// On BigThingService<br>@Transactional // Default (REQUIRED)<br>public void createBigThing(Data data) {<br>    System.out.println(&quot;--- BigThingService: Transaction TX_1 starts ---&quot;);<br>    // ... logic 1 ...<br>    <br>    // Call the helper. It will JOIN TX_1.<br>    smallThingService.saveSmallThing(data); <br>    <br>    if (data.isBad()) {<br>        throw new RuntimeException(&quot;Rollback TX_1!&quot;);<br>    }<br>}<br><br>...<br><br>// On SmallThingService<br>@Transactional // Default (REQUIRED)<br>public void saveSmallThing(Data data) {<br>    System.out.println(&quot;--- SmallThingService: Joining TX_1 ---&quot;);<br>    myRepo.save(data); // This is part of TX_1. No commit yet.<br>}</pre><p><strong>What Happens:</strong></p><ol><li>Proxy calls createBigThing(). Starts <strong>TX_1</strong>.</li><li>smallThingService.saveSmallThing() is called. Its proxy sees @Transactional (default REQUIRED). It just <strong>joins the existing TX_1.</strong></li><li>saveSmallThing() saves data. <strong>This is not committed.</strong></li><li>createBigThing() throws its exception.</li><li>Spring catches the exception and <strong>rolls back all of TX_1.</strong></li><li><strong>Result:</strong> Nothing is saved. Perfect all-or-nothing.</li></ol><h4>🎯 Scenario 2: The Independent Save (The Original Trap)</h4><p>You want to save the small thing <em>no matter what</em>, even if the big thing fails later.</p><pre>// On BigThingService<br>@Transactional // Default (REQUIRED)<br>public void createBigThing(Data data) {<br>    System.out.println(&quot;--- BigThingService: Transaction TX_1 starts ---&quot;);<br>    // ... logic 1 ...<br>    <br>    // Call the helper. It will run independently.<br>    smallThingService.saveSmallThing(data); <br>    <br>    if (data.isBad()) {<br>        throw new RuntimeException(&quot;Rollback TX_1!&quot;);<br>    }<br>}<br><br>...<br><br>// On SmallThingService<br>@Transactional(propagation = Propagation.REQUIRES_NEW) // Its own transaction<br>public void saveSmallThing(Data data) {<br>    System.out.println(&quot;--- SmallThingService: Suspending TX_1, Starting TX_2 ---&quot;);<br>    myRepo.save(data);<br>    System.out.println(&quot;--- SmallThingService: Committing TX_2 ---&quot;);<br>}</pre><p><strong>What Happens:</strong></p><ol><li>Proxy calls createBigThing(). Starts <strong>TX_1</strong>.</li><li>smallThingService.saveSmallThing() is called. Its proxy sees REQUIRES_NEW.</li><li>Spring <strong>suspends TX_1</strong>.</li><li>It starts a brand new, independent transaction: <strong>TX_2</strong>.</li><li>saveSmallThing() runs and saves data. It finishes. <strong>TX_2 commits.</strong> The data is now permanent.</li><li>Spring <strong>resumes TX_1</strong>.</li><li>createBigThing() throws its exception.</li><li>Spring catches it and <strong>rolls back TX_1.</strong></li><li><strong>Result:</strong> The saveSmallThing data is <strong>SAVED</strong>. The createBigThing data is <strong>ROLLED BACK</strong>.</li></ol><h3>The Takeaway</h3><p>Stop guessing. Stop blaming Spring.</p><ul><li>A call to this <strong>bypasses the proxy</strong>.</li><li>No proxy means <strong>no transaction</strong>.</li><li>If you need to call a transactional method from within the same class, use the self-inject hack or (better) <strong>move it to a new service.</strong></li><li>@Transactional vs. @Transactional(REQUIRES_NEW) is not a &quot;fix.&quot; It&#39;s a <em>design choice</em> about whether your work is &quot;All-or-Nothing&quot; or &quot;Independent.&quot;</li></ul><p>Now go fix your broken code.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1984f6667e57" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[☕ Java Daily Tip #2: You Just “Lost” an Object in Your HashSet]]></title>
            <link>https://medium.com/@olmosJT/java-daily-tip-2-you-just-lost-an-object-in-your-hashset-fd6634dba6d1?source=rss-d04feedd75e7------2</link>
            <guid isPermaLink="false">https://medium.com/p/fd6634dba6d1</guid>
            <category><![CDATA[hashset-internal-working]]></category>
            <category><![CDATA[hashset]]></category>
            <category><![CDATA[hashset-in-java]]></category>
            <category><![CDATA[java]]></category>
            <dc:creator><![CDATA[Olmos JT]]></dc:creator>
            <pubDate>Tue, 04 Nov 2025 12:44:45 GMT</pubDate>
            <atom:updated>2025-11-04T12:44:45.046Z</atom:updated>
            <content:encoded><![CDATA[<p>Stop me if you’ve done this. You’ve got a HashSet to store your unique items. You add an item, change it, and then try to remove it.</p><p>And it fails.</p><p>Look at this code. It’s so simple, it <em>has</em> to work:</p><pre>import java.util.HashSet;<br>import java.util.Objects;<br>import java.util.Set;<br><br>// A simple DTO. Notice hashCode() uses &#39;name&#39;.<br>@Getter @Setter<br>@AllArgsConstructor()<br>class User {<br>    private String name;<br>    <br>    @Override<br>    public boolean equals(Object o) {<br>        if (this == o) return true;<br>        if (o == null || getClass() != o.getClass()) return false;<br>        return Objects.equals(name, ((User) o).name);<br>    }<br>    <br>    @Override<br>    public int hashCode() {<br>        return Objects.hash(name);<br>    }<br>    <br>    @Override<br>    public String toString() { return &quot;User{&quot; + name + &quot;}&quot;; }<br>}<br><br>// Now, the crime.<br>public class TheSetTrap {<br>    public static void main(String[] args) {<br>        Set&lt;User&gt; set = new HashSet&lt;&gt;();<br>        <br>        User u1 = new User(&quot;Alice&quot;);<br>        System.out.println(&quot;Adding &#39;Alice&#39;, hash: &quot; + u1.hashCode());<br>        set.add(u1); // Set puts &#39;Alice&#39; in a bucket.<br>        <br>        System.out.println(&quot;Contains &#39;Alice&#39;? &quot; + set.contains(u1)); // true. Good.<br>        <br>        // --- THIS IS THE TRAP ---<br>        System.out.println(&quot;\n--- Mutating user in the set ---&quot;);<br>        u1.setName(&quot;Bob&quot;); // Mutate the object *while it&#39;s in the set*<br>        System.out.println(&quot;&#39;Bob&#39; new hash: &quot; + u1.hashCode());<br>        // ------------------------<br><br>        System.out.println(&quot;\nContains &#39;Bob&#39;? &quot; + set.contains(u1)); // This is about to fail<br>        System.out.println(&quot;Set state: &quot; + set);<br>        <br>        System.out.println(&quot;Removing &#39;Bob&#39;...&quot;);<br>        boolean removed = set.remove(u1); // This *also* fails<br>        <br>        System.out.println(&quot;Removed: &quot; + removed);<br>        System.out.println(&quot;Final set state: &quot; + set); // The object is still there!<br>    }<br>}</pre><p>The Output:</p><pre>Adding &#39;Alice&#39;, hash: 63350399<br>Contains &#39;Alice&#39;? true<br><br>--- Mutating user in the set ---<br>&#39;Bob&#39; new hash: 66996<br><br>Contains &#39;Bob&#39;? false<br>Set state: [User{Bob}]<br>Removing &#39;Bob&#39;...<br>Removed: false<br>Final set state: [User{Bob}]</pre><p>Read that output again. set.contains(u1) returned <strong>false</strong>... even though set.toString() <em>clearly shows</em> the User{Bob} object is still in there.</p><p>You’ve just broken the HashSet. You have an object in your set that you can&#39;t remove and can&#39;t even <em>find</em>.</p><h3>💥 The “Gotcha”: You’re Lying to the HashSet</h3><p>A HashSet doesn&#39;t check every object. It&#39;s fast because it uses hashCode() to find the right bucket to look in.</p><ol><li>When you added new User(&quot;Alice&quot;), its hash code (e.g., 63339103) was used. The set put u1 in <strong>Bucket 63339103</strong>.</li><li>When you mutated the object to &quot;Bob&quot;, its hash code <em>changed</em> (e.g., to 65166687).</li><li>Now, when you call set.contains(u1), the set calculates the <em>new</em> hash code (65166687) and looks in <strong>Bucket 65166687</strong>.</li><li>That bucket is empty. The HashSet says, &quot;Nope, don&#39;t have it.&quot;</li></ol><p>It’s not looking in the wrong place. <em>You moved the object</em> without telling the set. The object is still sitting in <strong>Bucket 63339103</strong>, but you’ll never find it again because you’re now looking for it under the hash code for “Bob”.</p><p><strong>✅ The Tip: Never Mutate a Key</strong></p><p>This is the golden rule:</p><blockquote>Never mutate an object’s state <em>while it’s in a </em><em>HashSet</em> (or as a key in a HashMap) if that state is used in your hashCode() or equals() methods.</blockquote><p>You’re not allowed to. You’re breaking the contract of the data structure.</p><p>The fix? If you <em>must</em> change it, do it the right way:</p><p><strong>THE TRAP (LAZY):</strong> u1.setName(&quot;Bob&quot;);</p><p><strong>THE FIX (SMART):</strong> set.remove(u1); u1.setName(&quot;Bob&quot;); set.add(u1);</p><p>Remove the object. Change the object. Add the object back.</p><p>Stop breaking your collections.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=fd6634dba6d1" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[ Spring Boot Daily Tip #1: The Validation “Inception”]]></title>
            <link>https://medium.com/@olmosJT/spring-boot-daily-tip-1-the-validation-inception-5dc23a614c26?source=rss-d04feedd75e7------2</link>
            <guid isPermaLink="false">https://medium.com/p/5dc23a614c26</guid>
            <category><![CDATA[java]]></category>
            <category><![CDATA[beginners-guide]]></category>
            <category><![CDATA[validation]]></category>
            <category><![CDATA[spring-boot]]></category>
            <dc:creator><![CDATA[Olmos JT]]></dc:creator>
            <pubDate>Mon, 03 Nov 2025 11:16:36 GMT</pubDate>
            <atom:updated>2025-11-03T11:16:36.643Z</atom:updated>
            <content:encoded><![CDATA[<p>You added @Valid to your DTO. You think you&#39;re safe. You&#39;re probably not. Let&#39;s talk about the three <strong><em>gotchas</em></strong> of Spring Validation.</p><ol><li><strong>The “Top-Level-Only” Gotcha</strong> (@Valid on a @RequestBody)</li></ol><p>You have this in your controller: @PostMapping(&quot;/wow&quot;) ... @Valid @RequestBody WowDTO wow</p><p>This tells Spring: “Please audit this WowDTO object.&quot; Spring checks all the @NotBlank, @Email, etc. fields... <strong>but only on the </strong>WowDTO<strong> itself.</strong></p><p><strong>2. The Nested “Gotcha” </strong>(The Matryoshka Doll Problem)</p><p>But what if your WowDTO contains another complex object?</p><pre>public class WowDTO {<br>    @NotBlank<br>    private String mainField;<br>    <br>    @NotNull<br>    private NestedDTO nested; <br>}<br><br>@AllArgsConstructor<br>public class NestedDTO {<br>    @NotBlank<br>    private String importantNestedField;<br>}</pre><p>You send a WowDTO with a valid mainField, but the NestedDTO has a null importantNestedField:</p><pre>var wowDto = new WowDTO();<br>wowDto.mainField(&quot;Hey, I&#39;m here!&quot;)<br>wowDto.nested(new NestedDTO(null));<br><br>// This is for demonstration purpose.<br>// Do not try to find out errors here ;)</pre><p><strong>It passes validation.</strong></p><p><em>Why?</em></p><blockquote>You only told Spring to validate the <em>outer</em> object (WowDTO). You never told it to look <em>inside</em> at the NestedDTO.</blockquote><p>This is why you need @Valid on a field:</p><pre>public class WowDTO {<br>    @NotBlank<br>    private String mainField;<br>    <br>    @Valid // &lt;-- THE MAGIC<br>    private NestedDTO nested; <br>}</pre><p>Adding @Valid to the nested field tells Spring: <strong>&quot;Hey, this field is <em>another</em> object that needs its own validation. Go check its insides, too.&quot;</strong></p><p>3. <strong>The “It Doesn’t Work in Services” Gotcha</strong> (@Validated)</p><p>Now you try to be clever. You put a validation annotation on a <em>service</em> method parameter:</p><pre>@Service<br>public class WowService {<br>    public void findSomething(@NotBlank String p) {<br>        // ...<br>    }<br>}</pre><p>You call this method with a blank string. <strong>It works. No validation error is thrown.</strong></p><p>Why?</p><blockquote>By default, Spring doesn’t validate method parameters in your services. You have to explicitly turn on this feature for the whole class.</blockquote><p>This is what @Validated on a class does:</p><pre>@Service<br>@Validated // &lt;-- This &quot;activates&quot; method validation for the class<br>public class WowService {<br>    <br>    // NOW this @NotBlank will be checked<br>    public void findSomething(@NotBlank String p) {<br>        // ...<br>    }<br>}</pre><p>Now it should be clear why devs usually put @Validatedon top of Controller class.</p><blockquote>If I put the @Validated annotation on my Controller class, does that validation “pass down” to my Service class? Or, do I still need to add @Validated to my Service class to make <em>its</em> method validations work?</blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5dc23a614c26" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[☕ Java Daily Tip #1: The Wrapper Class “Cache”]]></title>
            <link>https://medium.com/@olmosJT/java-daily-tip-1-the-wrapper-class-cache-83ad96c8d95b?source=rss-d04feedd75e7------2</link>
            <guid isPermaLink="false">https://medium.com/p/83ad96c8d95b</guid>
            <category><![CDATA[java]]></category>
            <dc:creator><![CDATA[Olmos JT]]></dc:creator>
            <pubDate>Mon, 03 Nov 2025 10:48:29 GMT</pubDate>
            <atom:updated>2025-11-03T10:48:29.200Z</atom:updated>
            <content:encoded><![CDATA[<p>Did you know Java saves memory by caching a pool of common values for its wrapper classes (like Integer, Long, and Byte)?</p><p>Most developers don’t, and it leads to one of the most famous <em>“bugs”</em> in the language — or at least, one of the most common interview traps.</p><p><strong>The Tip</strong></p><p>Java guarantees that Integer objects created from <strong>-128 to 127</strong> will point to the <em>exact same object</em> in memory. This is done via the static Integer.valueOf(int) method, which is what autoboxing uses behind the scenes.</p><p><strong>The “Gotcha” (Try this!)</strong></p><p>This caching mechanism means == (which checks memory address) behaves differently than you might expect.</p><pre>// --- Caching in action (values are in the -128 to 127 range) ---<br>Integer a = 100;<br>Integer b = 100;<br>System.out.println(a == b); // This will print: true<br><br>// --- No caching (values are outside the range) ---<br>Integer c = 200;<br>Integer d = 200;<br>System.out.println(c == d); // This will print: false</pre><p>In the second case, Java creates two <em>new</em>, separate Integer objects because 200 isn&#39;t in the cached pool.</p><p><strong>Your Takeaway</strong></p><p>Never, ever use == to compare wrapper objects for equality.</p><p>(You might be thinking, “Everyone knows this!” — but this cache behavior is the <em>technical reason why</em> that rule is so critical.)</p><p><strong>Always use the </strong><strong>.equals() method.</strong> It compares the actual <em>value</em> inside, not the memory address, and will save you from this trap every time.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/259/1*eV0V6DO2OxO6qbhjdG4HoA.jpeg" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=83ad96c8d95b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Forget the Roadmaps. Want to Learn Spring Boot? Just Write Code.]]></title>
            <link>https://medium.com/@olmosJT/forget-the-roadmaps-want-to-learn-spring-boot-just-write-code-e9b6ba8adb94?source=rss-d04feedd75e7------2</link>
            <guid isPermaLink="false">https://medium.com/p/e9b6ba8adb94</guid>
            <category><![CDATA[beginners-guide]]></category>
            <category><![CDATA[spring-boot]]></category>
            <category><![CDATA[java]]></category>
            <dc:creator><![CDATA[Olmos JT]]></dc:creator>
            <pubDate>Mon, 03 Nov 2025 10:33:44 GMT</pubDate>
            <atom:updated>2025-11-03T10:33:44.154Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*sx5mx6fFoSKqKEojtfoMpA.jpeg" /><figcaption>Give me coffee!!! nah, just kidding ;)</figcaption></figure><blockquote>You don’t need another 10-step guide, a $500 course, or a new laptop. You just need to start.</blockquote><p>Everyone’s selling you a “roadmap.” A 50-point checklist. The “Complete 2025 Guide to Spring Boot.”</p><p>Here’s the truth: <strong>You can throw them all away.</strong></p><p>My goal isn’t to give you another 100 things to learn. It’s to tell you the only thing that matters.</p><blockquote><strong>Just write code.</strong></blockquote><p>That’s it. That’s the entire <em>“secret.”</em></p><p>You’re probably stuck because you think you need to be perfect. You think you have to <em>understand</em> everything before you can <em>do</em> anything. You’re trying to read the entire manual for a car you’ve never even turned on.</p><p>Here’s a fact: You will <strong>never</strong> know “everything” about Spring Boot. The framework is built on decades of work by thousands of people. A single person can’t master it all. Nobody expects you to.</p><p>So, stop looking at guides, cheatsheets, and fancy roadmaps. Stop waiting for the perfect M3 laptop.</p><p>Do this instead:</p><ol><li>Learn the absolute bare-minimum basics. What’s a @RestController? What&#39;s an @GetMapping?</li><li>Open your IDE and <strong>build something.</strong> Make a “Hello, World” API.</li><li>It will break. You won’t understand why.</li><li><strong>Now, use AI.</strong> Don’t listen to people who say “don’t use it.” Ask it: “What the hell does this error mean?” “Why does this work like that?” Use it as your personal tutor who has infinite patience.</li></ol><blockquote>You don’t learn to swim by reading books about water. You learn by getting in the pool.</blockquote><p>Stop preparing. Stop studying.</p><p>Open your editor. Write one line of code.</p><p><strong>Congratulations. You’re a Spring Boot developer.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/498/1*PJsVqoVwTYlKEhj-3_biRw.gif" /><figcaption>Golden Boy loves computers</figcaption></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e9b6ba8adb94" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>