<?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>Forem: Zakaria Abdelali</title>
    <description>The latest articles on Forem by Zakaria Abdelali (@gadoma).</description>
    <link>https://forem.com/gadoma</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.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1405907%2F9cf72af5-7000-432b-9008-315ab0183d06.jpg</url>
      <title>Forem: Zakaria Abdelali</title>
      <link>https://forem.com/gadoma</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/gadoma"/>
    <language>en</language>
    <item>
      <title>WTH is JDBC, Spring JDBC, JPA, Hibernate, ORM, Spring Boot JPA</title>
      <dc:creator>Zakaria Abdelali</dc:creator>
      <pubDate>Mon, 19 Jan 2026 08:49:45 +0000</pubDate>
      <link>https://forem.com/gadoma/wth-is-jdbc-spring-jdbc-jpa-hibernate-orm-spring-boot-jpa-30m9</link>
      <guid>https://forem.com/gadoma/wth-is-jdbc-spring-jdbc-jpa-hibernate-orm-spring-boot-jpa-30m9</guid>
      <description>&lt;h2&gt;
  
  
  Evolution of Database Access in Java
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fhyqtdnfyt335z4aghope.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fhyqtdnfyt335z4aghope.png" alt=" " width="336" height="500"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This article explains how Java database access evolved step by step:&lt;br&gt;
JDBC → Spring JDBC → JPA → Hibernate → Spring Boot JPA&lt;/p&gt;

&lt;p&gt;Each step fixes problems from the previous one.&lt;/p&gt;




&lt;h2&gt;
  
  
  1. JDBC (Java Database Connectivity)
&lt;/h2&gt;

&lt;p&gt;JDBC is the basic and lowest-level way for Java to talk to a database.&lt;br&gt;
You control everything manually.&lt;/p&gt;

&lt;h3&gt;
  
  
  Features
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;JDBC Driver (a bridge between Java and the database)&lt;/li&gt;
&lt;li&gt;Connection (opens a connection to the database)&lt;/li&gt;
&lt;li&gt;Statement (executes SQL queries)&lt;/li&gt;
&lt;li&gt;PreparedStatement (precompiled SQL, safer and faster)&lt;/li&gt;
&lt;li&gt;ResultSet (holds the data returned from the database)&lt;/li&gt;
&lt;li&gt;Full control over SQL&lt;/li&gt;
&lt;li&gt;Works with many databases&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Problems
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Too much repeated code&lt;/li&gt;
&lt;li&gt;Must manually open and close connections&lt;/li&gt;
&lt;li&gt;Error handling is hard&lt;/li&gt;
&lt;li&gt;SQL mixed with business logic&lt;/li&gt;
&lt;li&gt;Hard to maintain large projects&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Solution
&lt;/h3&gt;

&lt;p&gt;JDBC works, but it is too low-level.&lt;br&gt;
We need something simpler.&lt;/p&gt;




&lt;h2&gt;
  
  
  2. Spring JDBC
&lt;/h2&gt;

&lt;p&gt;Spring JDBC simplifies JDBC.&lt;br&gt;
Spring manages connections and errors for you.&lt;/p&gt;

&lt;h3&gt;
  
  
  Features
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Less boilerplate code&lt;/li&gt;
&lt;li&gt;Automatic resource management&lt;/li&gt;
&lt;li&gt;Cleaner exception handling&lt;/li&gt;
&lt;li&gt;Still uses SQL&lt;/li&gt;
&lt;li&gt;Easier than plain JDBC&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Problems
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Still writing SQL manually&lt;/li&gt;
&lt;li&gt;Manual mapping from rows to objects&lt;/li&gt;
&lt;li&gt;Database logic still visible everywhere&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Solution
&lt;/h3&gt;

&lt;p&gt;Developers want to work with &lt;strong&gt;objects&lt;/strong&gt;, not tables.&lt;br&gt;
This leads to ORM.&lt;/p&gt;




&lt;h2&gt;
  
  
  3. JPA (Java Persistence API)
&lt;/h2&gt;

&lt;p&gt;JPA is a &lt;strong&gt;standard&lt;/strong&gt; for ORM (Object Relational Mapping).&lt;br&gt;
It defines &lt;em&gt;how&lt;/em&gt; ORM should work, not &lt;em&gt;how to implement it&lt;/em&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  Features
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Maps tables to Java objects&lt;/li&gt;
&lt;li&gt;Standard API (same rules everywhere)&lt;/li&gt;
&lt;li&gt;Reduces SQL usage&lt;/li&gt;
&lt;li&gt;Database independent&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Problems
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;JPA is only rules, not real code&lt;/li&gt;
&lt;li&gt;Cannot run alone&lt;/li&gt;
&lt;li&gt;Needs an implementation&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Solution
&lt;/h3&gt;

&lt;p&gt;Use a JPA implementation like Hibernate.&lt;/p&gt;




&lt;h2&gt;
  
  
  4. Hibernate
&lt;/h2&gt;

&lt;p&gt;Hibernate is a &lt;strong&gt;JPA implementation&lt;/strong&gt;.&lt;br&gt;
It actually does the ORM work.&lt;/p&gt;

&lt;h3&gt;
  
  
  Features
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Automatic SQL generation&lt;/li&gt;
&lt;li&gt;Object-based database access&lt;/li&gt;
&lt;li&gt;Caching support (store data in memory for faster access)&lt;/li&gt;
&lt;li&gt;Lazy loading (load data only when needed)&lt;/li&gt;
&lt;li&gt;Database independent&lt;/li&gt;
&lt;li&gt;Very powerful and flexible&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Problems
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Heavy configuration&lt;/li&gt;
&lt;li&gt;Hard for beginners&lt;/li&gt;
&lt;li&gt;Too much setup for small projects&lt;/li&gt;
&lt;li&gt;Performance issues if used incorrectly&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Alternatives to Hibernate
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;EclipseLink (official JPA reference implementation)&lt;/li&gt;
&lt;li&gt;OpenJPA (Apache project)&lt;/li&gt;
&lt;li&gt;MyBatis (SQL-focused, not full ORM)&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Solution
&lt;/h3&gt;

&lt;p&gt;Hibernate is powerful, but needs simplification.&lt;br&gt;
Spring Boot solves this.&lt;/p&gt;




&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F064milyxkdr1djlxcri4.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F064milyxkdr1djlxcri4.png" alt=" " width="768" height="543"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  5. Spring Boot JPA
&lt;/h2&gt;

&lt;p&gt;Spring Boot JPA combines:&lt;br&gt;
Spring Boot + JPA + Hibernate&lt;/p&gt;

&lt;p&gt;Focuses on simplicity and speed.&lt;/p&gt;

&lt;h3&gt;
  
  
  Features
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Auto configuration (no manual setup)&lt;/li&gt;
&lt;li&gt;Uses Hibernate by default&lt;/li&gt;
&lt;li&gt;Easy repository pattern&lt;/li&gt;
&lt;li&gt;Clean and readable structure&lt;/li&gt;
&lt;li&gt;Production ready&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Problems
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Less low-level control&lt;/li&gt;
&lt;li&gt;Some behavior is hidden by auto configuration&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Solution
&lt;/h3&gt;

&lt;p&gt;Best choice for modern applications.&lt;br&gt;
Use lower levels only when needed.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;&lt;strong&gt;For more details:&lt;/strong&gt;&lt;/em&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://dimitri.codes/difference-spring-data-jdbc-jpa/" rel="noopener noreferrer"&gt;Difference-Spring-Data-JDBC-JPA&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>hibernate</category>
      <category>springboot</category>
      <category>springjpa</category>
      <category>jpa</category>
    </item>
  </channel>
</rss>
