Thoughts on Java

  • Blog
    • Hibernate & JPA Tutorials
    • Hibernate Tips
  • Videos
  • Book
  • Training
  • Work with me
  • About
    • About Thoughts on Java
    • Resources
  • Member Library
You are here: Home / Persistence

Persistence

Persistence with JPA and Hibernate is one of the main topics in my daily work and on this blog. This page provides an overview of the articles I wrote about this topic and you should expect more of them in the future.

JPA 2.1

JPA 2.1 introduced a set of new features to the specification to make the work with a relational database easier and more efficient. You can get an overview about all the new features in:

  • JPA 2.1 – 12 features every developer should know.

Or if you already know what you are searching for, have a look at the list of JPA 2.1 related articles:

  • Attribute Converter
    • JPA 2.1 – How to implement an Attribute Converter
    • JPA 2.1 Attribute Converter – The better way to persist enums
    • How to use a JPA Attribute Converter to encrypt your data
  • Named Entity Graph
    • JPA 2.1 Entity Graph – Part 1: Named entity graphs
  • Entity Graph
    • JPA 2.1 Entity Graph – Part 2: Define lazy/eager loading at runtime
  • Criteria API
    • Criteria Update/Delete – The easy way to implement bulk operations with JPA2.1
  • Constructor Result Mappings
    • Result Set Mapping: Constructor Result Mappings

 

Result Set Mappings

If queries get complex, the limited feature set of JPQL can become an issue and we need to use native SQL queries. The only downside of it is, that native queries return a List<Object[]> and that we need to cast all these Objects into the right type. An easy solution for it are Result Set Mappings which I explained in a series of blog posts:

  • Result Set Mapping: The Basics
  • Result Set Mapping: Complex Mappings
  • Result Set Mapping: Constructor Result Mappings
  • Result Set Mapping: Hibernate specific features

 

Performance

Persisting data with Hibernate and JPA is easy, but you need to be aware of some things to avoid performance pitfalls:

  • 5 ways to initialize lazy relations and when to use them
  • How to activate Hibernate Statistics to analyze performance issues

 

Test

I usually use Arquillian to test my Java EE applications with the application server that will be used in production. Arquillian and the persistence extension can be used to manage the container, deploy the application and manage the database. I described how to do this in:

  • Testing with Aliens: How to test a JPA type converter with Arquillian.

Join over 5.000 developers
in the
Thoughts on Java Library

Ebooks Sidebar Get free access to ebooks, cheat sheets and training videos.
Join Now!
Special Launch Price

Let’s Connect


Thorben Janssen
  • Facebook
  • Github
  • Google+
  • Twitter
  • YouTube

Speaking at

8th March 2018
Voxxed Days Zurich (Talk):
Hibernate Tips ‘n’ Tricks - 15 Tips to solve common problems

13th March 2018
JavaLand (Talk):
Hibernate - State of the Union

15th March 2018
JavaLand (Workshop):
Hibernate Performance Tuning

10th-11th April 2018
Munich (Training):
Hibernate für Fortgeschrittene

12th-13th April 2018
Munich (Training):
Hibernate Performance Tuning

April 2018
JAX (Talk):
Hibernate Tipps und Tricks: Schnelle Lösungen für typische Probleme und Anwendungsfälle

April 2018
JAX (Workshop):
Hibernate-Workshop für Fortgeschrittene

Looking for an inhouse training?

Featured Post

Getting Started With Hibernate

Getting Started With Hibernate

12 Java YouTube Channels You Should Follow In 2018

12 Java YouTube Channels You Should Follow In 2018

Ultimate Guide – Association Mappings with JPA and Hibernate

Ultimate Guide – Association Mappings with JPA and Hibernate

Ultimate Guide to JPQL Queries with JPA and Hibernate

Ultimate Guide to JPQL Queries with JPA and Hibernate

Hibernate Best Practices

Hibernate Best Practices

Recent Posts

  • 5 Common Hibernate Mistakes That Cause Dozens of Unexpected Queries
  • Hibernate Tips: How to map an entity to multiple tables
  • Hibernate Tips: Easiest way to manage bi-directional associations
  • Hibernate & jOOQ – A Match Made in Heaven
  • Hibernate Tips: How to avoid Hibernate’s MultipleBagFetchException
  • Getting Started with jOOQ – Building SQL Queries in Java
  • Composition vs. Inheritance with JPA and Hibernate
  • JPA Tips: How to map a Duration attribute
  • Hibernate Tips: How to use an ORDER BY clause in a CriteriaQuery
  • What’s the difference between JPA, Hibernate and EclipseLink

Copyright © 2018 · Thoughts on Java

  • Impressum
  • Disclaimer
  • Privacy Policy
Thoughts on Java