DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Please enter at least three characters to search
Refcards Trend Reports
Events Video Library
Refcards
Trend Reports

Events

View Events Video Library

Zones

Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks

Because the DevOps movement has redefined engineering responsibilities, SREs now have to become stewards of observability strategy.

Apache Cassandra combines the benefits of major NoSQL databases to support data management needs not covered by traditional RDBMS vendors.

The software you build is only as secure as the code that powers it. Learn how malicious code creeps into your software supply chain.

Generative AI has transformed nearly every industry. How can you leverage GenAI to improve your productivity and efficiency?

Related

  • How Spring and Hibernate Simplify Web and Database Management
  • Enhanced Query Caching Mechanism in Hibernate 6.3.0
  • Multi-Tenancy and Its Improved Support in Hibernate 6.3.0
  • Troubleshooting Kubernetes Pod Crashes: Common Causes and Effective Solutions

Trending

  • Advancing Your Software Engineering Career in 2025
  • Build a Simple REST API Using Python Flask and SQLite (With Tests)
  • Efficient API Communication With Spring WebClient
  • Introducing Graph Concepts in Java With Eclipse JNoSQL
  1. DZone
  2. Coding
  3. Java
  4. Hibernate and JPA Tutorial: Crash Course [Video]

Hibernate and JPA Tutorial: Crash Course [Video]

Ever looked for a comprehensive tutorial to Hibernate and JPA that is fun and entertaining at the same time? Look no further than this video tutorial.

By 
Marco Behler user avatar
Marco Behler
DZone Core CORE ·
Aug. 26, 22 · Tutorial
Likes (2)
Comment
Save
Tweet
Share
7.0K Views

Join the DZone community and get the full member experience.

Join For Free

Ever looked for a comprehensive tutorial to Hibernate and JPA that is fun and entertaining at the same time?  The video tutorial below is a crash course into the Hibernate and JPA universe. From mapping annotations and SessionFactory setup to HQL and criteria queries, we cover all the basics you’ll need to get started with Hibernate and JPA. 

What’s in the Video?

There are so many terms when it comes to Hibernate: Hibernate (i.e., JPA, HQL, JPQL, and SQL) that we first have to understand what Hibernate is and what problem it tries to solve. The core problem is mapping between Java classes and relational database tables.

Afterward, we'll jump right into the project. You can choose to clone the sample project to follow along with this video, and we'll dive deeper into what dependencies you need to get started with Hibernate. Hint: It's not that many. In fact, it's only one: even though modern stacks like Spring Boot might make you believe differently.

Once we have the dependencies sorted out, we'll have a look at Hibernate's mapping annotations. One of the core ways to let Hibernate know about your database tables is through annotations such as @Entity, @Table, @Column, and many more. We'll play with those. We'll also figure out that one of the most popular Hibernate books spends roughly 200 pages on mapping annotations. A lot of work you have to go through yourself, which cannot be condensed into just a video.

Having the dependencies and annotations set up correctly means we can now go about creating a SessionFactory. A SessionFactory essentially is Hibernate. It's the core class you want to use whenever you want to, for example, fire queries against a database, or simply just save one of your objects.

When the SessionFactory is up and running, we can start considering how to make basic CUD queries work. We can create, update, and delete, but not yet send queries. Hence, we'll use the SessionFactory to do just that, save and update a couple of users we had previously created.

Let's add an "R" to CUD and make it fully CRUD by executing HQL queries against the database. HQL queries are Hibernate's way of querying database tables, though you don't write your HQL against specific database tables; rather, against your mapped object hierarchy. At the end of the day, Hibernate will transform the HQL into SQL for you and you'll see it printed out in the console.

Up next, let's solve the big question of what JPA, the Java Persistence API actually is. By just swapping out a couple of classes, we can actually turn our application from a Hibernate application into a JPA application. We'll also talk about the real-life implications this actually has.

Every project, sooner or later, wants to create dynamic SQL queries. Hibernate/JPA's way of doing that is through its Criteria API. It's a bit cumbersome to use, but it does the job. Again, it's several dozen pages in the official documentation, but we'll try our best and cover the core concepts of the Criteria API.

Before we come to a close, we'll also spend some time figuring out where Hibernate/JPA fits into the Spring Boot universe and how it compares to other projects, such as Spring Data JPA.

By the end of this video, you should have a good grasp of basic Hibernate and we'll finish by giving you some tips on what to learn next to become a Hibernate expert.

Enjoy.


Crash (computing) Hibernate

Opinions expressed by DZone contributors are their own.

Related

  • How Spring and Hibernate Simplify Web and Database Management
  • Enhanced Query Caching Mechanism in Hibernate 6.3.0
  • Multi-Tenancy and Its Improved Support in Hibernate 6.3.0
  • Troubleshooting Kubernetes Pod Crashes: Common Causes and Effective Solutions

Partner Resources

×

Comments
Oops! Something Went Wrong

The likes didn't load as expected. Please refresh the page and try again.

ABOUT US

  • About DZone
  • Support and feedback
  • Community research
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Core Program
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 3343 Perimeter Hill Drive
  • Suite 100
  • Nashville, TN 37211
  • support@dzone.com

Let's be friends:

Likes
There are no likes...yet! 👀
Be the first to like this post!
It looks like you're not logged in.
Sign in to see who liked this post!