<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: theDog</title>
    <description>The latest articles on DEV Community by theDog (@thedogeg48).</description>
    <link>https://dev.to/thedogeg48</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4083735%2F2f41037c-c513-4654-bf41-a7ab4ec2c23d.jpg</url>
      <title>DEV Community: theDog</title>
      <link>https://dev.to/thedogeg48</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/thedogeg48"/>
    <language>en</language>
    <item>
      <title>5 JPQL Patterns That Nearly Killed Our Banking CRM Performance</title>
      <dc:creator>theDog</dc:creator>
      <pubDate>Tue, 18 Aug 2026 18:08:28 +0000</pubDate>
      <link>https://dev.to/thedogeg48/java-spring-boot-performance-issues-and-solutions-5ege</link>
      <guid>https://dev.to/thedogeg48/java-spring-boot-performance-issues-and-solutions-5ege</guid>
      <description>&lt;p&gt;5 JPQL patterns that nearly killed our CRM performance at a banking client. We were shipping customer queries in milliseconds—then scaled to 100k+ records. Here’s what broke us and how we fixed it.&lt;/p&gt;

&lt;p&gt;🔴 Pattern #1: The N+1 Query Nightmare&lt;/p&gt;

&lt;p&gt;&lt;code&gt;Query: SELECT c FROM Customer c&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Looks innocent. Except we fetch INDIVIDUAL, ORGANIZATION, GROUP types—each with separate queries to get their details. 1 query became 100k queries.&lt;/p&gt;

&lt;p&gt;✅ Solution: JOIN FETCH&lt;/p&gt;

&lt;p&gt;&lt;code&gt;SELECT c FROM Customer c &lt;br&gt;
LEFT JOIN FETCH c.details&lt;br&gt;
WHERE c.status = 'ACTIVE'&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;One query. All data. Problem solved. We cut response time from 8s to 200ms.&lt;/p&gt;

&lt;p&gt;🔴 Pattern #2: Pagination With JOIN FETCH&lt;/p&gt;

&lt;p&gt;&lt;code&gt;Query.setFirstResult(0).setMaxResults(100)&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Sounds good. Except JPQL pagination happens after the JOIN, so you’re paginating wrong data. Nightmare fuel.&lt;/p&gt;

&lt;p&gt;✅ Solution: Two-phase pagination&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;1.  Fetch IDs first: `SELECT c.id FROM Customer c WHERE...`(paginate here)
2.  Fetch full objects: `SELECT c FROM Customer c WHERE c.id IN (:ids)`
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;p&gt;Double query, but correct results at scale.&lt;/p&gt;

&lt;p&gt;🔴 Pattern #3: Fetching Sub-Collections&lt;/p&gt;

&lt;p&gt;&lt;code&gt;SELECT c FROM Customer c &lt;br&gt;
LEFT JOIN FETCH c.accounts&lt;br&gt;
LEFT JOIN FETCH c.transactions&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;You think you’re fetching everything. You’re actually creating a Cartesian product. 1 customer → 1000 rows.&lt;/p&gt;

&lt;p&gt;✅ Solution: Separate queries&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Load customers&lt;/li&gt;
&lt;li&gt;Load accounts by customer IDs&lt;/li&gt;
&lt;li&gt;Load transactions by account IDs&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;More queries, but predictable performance. MapStruct handles the mapping.&lt;/p&gt;

&lt;p&gt;The hard lesson: JPQL is magical until it isn’t. Scale reveals everything.&lt;/p&gt;

&lt;p&gt;Full deep-dive incoming—patterns, benchmarks, and the exact queries that saved us 6 hours of processing time daily.&lt;/p&gt;

&lt;p&gt;Follow for the blog post 🧵&lt;/p&gt;

&lt;p&gt;Gumroad links : &lt;br&gt;
skmjster.gumroad.com/subscribe&lt;br&gt;
&lt;/p&gt;
&lt;div class="crayons-card c-embed text-styles text-styles--secondary"&gt;
    &lt;div class="c-embed__content"&gt;
        &lt;div class="c-embed__cover"&gt;
          &lt;a href="https://skmjster.gumroad.com/l/army-soldier-reporting" class="c-link align-middle" rel="noopener noreferrer"&gt;
            &lt;img alt="" src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fpublic-files.gumroad.com%2Fmc9cnxyx9prjjbl2bteou3gr3v4t" height="533" class="m-0" width="800"&gt;
          &lt;/a&gt;
        &lt;/div&gt;
      &lt;div class="c-embed__body"&gt;
        &lt;h2 class="fs-xl lh-tight"&gt;
          &lt;a href="https://skmjster.gumroad.com/l/army-soldier-reporting" rel="noopener noreferrer" class="c-link"&gt;
            Army Soldier Reporting For Iphone.
          &lt;/a&gt;
        &lt;/h2&gt;
          &lt;p class="truncate-at-3"&gt;
            Track soldiers, assignments, and duty rosters instantly.No backend. No login. Works offline on your phone.Built for military use. Deployed by Greek Army personnel.WHAT YOU GET:- Single HTML file (deployable in seconds)- Works on any phone (iOS/Android)- Stores data locally—no cloud, no servers- Search, filter, export to CSV- Dark mode included- Completely offlineHOW TO USE:1. Download the HTML file2. Email it to yourself3. Open on iPhone via Microsoft Edge4. Pin to home screen (acts like a native app)5. Start trackingPerfect for:- Unit leaders tracking personnel- Duty roster management- Squad assignments- Quick lookups in the fieldNo technical knowledge needed. Works instantly.Includes setup guide + usage instructions.
          &lt;/p&gt;
        &lt;div class="color-secondary fs-s flex items-center"&gt;
            &lt;img alt="favicon" class="c-embed__favicon m-0 mr-2 radius-0" src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fpublic-files.gumroad.com%2F8oh8gin1zmim3o4b610nggyg10u4" width="400" height="400"&gt;
          skmjster.gumroad.com
        &lt;/div&gt;
      &lt;/div&gt;
    &lt;/div&gt;
&lt;/div&gt;


&lt;p&gt;``&lt;/p&gt;

</description>
      <category>java</category>
      <category>springboot</category>
      <category>microservices</category>
      <category>jpql</category>
    </item>
  </channel>
</rss>
