Hibernate or JPA annotations to use
hibernate, java, jpa
Solution
Hibernate provides one of the JPA implementations. If you use purely JPA in your code, you are free to change to a different implementation if a requirement arises. For example, EclipseLink/TopLink and OpenJPA are implementations which may be required for a different customer. A comprehensive list of implementations is here.
If you are compelled to use any exotic features provided by hibernate which are not in JPA specification, you should go for hibernate specific APIs in your code base. A related discussion from hibernate forum here.
Problem
I am using Hibernate in our projects and annotation based configuration for Hibernate Domain Pojo Objects. For Annotations based configuration we have two options - JPA based annotations using `javax.persistence.*` - Use Hibernate Native Annotations `org.hibernate.annotations.*` Currently we use JPA based annotation configuration for our POJO files and Hibernate native API like SessionFactory, Session, etc to open session and perform DB operations. I have these questions: - Is there any problem mixing both JPA annotations and use Hibernate native API? - This link explains one such issue (cascade-jpa-hibernate-annotation-common-mistake) - Please provide your expertise, which type of annotations to use - JPA - Hibernate native - Mix both of them?