Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

JPA/Hibernate in Java SE 6, Best Practices for data access

I am starting a normal Java SE project and i am planning to use JPA/Hibernate. I was wondering if anyone could enlighten me as to what is considered the best way to interact with Hibernate in this environment (data access layers)?

like image 352
Jason Miesionczek Avatar asked Nov 20 '08 14:11

Jason Miesionczek


1 Answers

I'm not sure what's considered the best approach to this, but at my workplace, we have based most of our Hibernate interaction on these articles:

Don't let Hibernate steal your identity and Generic Data Access Objects

They show you how to make your mapped classes in a smart way, and how to implement a generic DAO that can be reused for any persistent class. This has worked out nicely for us.

like image 62
Nils-Petter Nilsen Avatar answered Oct 10 '22 21:10

Nils-Petter Nilsen