Best Spring API for developing GenericDao
-
12-11-2019 - |
Question
I see lot of implementation technique about spring jpa(jpatemplate,japdaosupport spring-data-jpa ,native way entitymanager,HibernateSupport,ect ),which one is best technique for developing Generic DAO ,that should be clean resource allocation ,transaction management , and high performance . what are pros and cons
scenario
- entity >70
- web app and webservices
- future osgi support and multiple data sources
Solution
I think the best way would be to stick to the @PersistentContext to handle instances of EntityManagers, and inject them into some third party generic dao. You could write one on your own, use spring-data as mentioned by @Ralph or try libraries like Hades.
OTHER TIPS
Spring-data-jpa comes with an already compleate GenericDao (with all the stuff you mentiond), but as far as I know you will need at least a (empty) interface for each concrete dao.