The previous blog in the JPA implementation patterns series discussed different ways to test your JPA code. Figuring out how to test DAO’s and then being frustrated because the existing literature on JPA seemed to say very little on this subject, was actually the trigger for me to write these blogs. I have now come full circle, which means it’s time to wrap up the series. There’s lots more to write about, so keep following this blog! 🙂
After discovering that there was a lack of documentation on how to use JPA in real-life scenario’s, I have written a series of blogs about the JPA implementation patterns I discovered while writing JPA code. To wrap up the series, I have made an overview of all the patterns that have been discussed for easy reference. The list is mostly in chronological order. I only changed the order slightly to make a distinction between the basic patterns and the advanced patterns.
- Data Access Objects
- Saving (detached) entities
- Retrieving entities
- Removing entities
- Service Facades and Data Transfers Objects
- Bidirectional assocations
- Lazy loading
- Bidirectional associations vs. lazy loading
- Using UUIDs as primary keys (guest blog by Albert Sikkema)
- Field access vs. property access
- Mapping inheritance hierarchies
I hope these patterns will help you when writing your JPA application. If there is one thing to take away from this series is that it is pays off to really look into the details of JPA. Even though the promise of an abstraction layer invites you to take ORM for granted. Incorrect database usage is still Java EE performance problem #1, so there is a lot to gain here!
While writing down my experiences I have learned a lot about JPA. First of all because writing something down forces you to really look into the details, but most importantly because of the feedback I got on the blogs and after my presentation at J-Spring, the Dutch Java developer conference. And finally I would like to thank my colleague Albert Sikkema for his contribution to the series!