Torai Torai - 2 months ago 28
Java Question

Query object on java persistence and hibernate

What's the difference between Query object on:
- javax.persitence
- org.hibernate
Which should I use, and why ?


First of all, based on the tags of your question, is not relevant for you, as it deals with MBeans, and not DB queries.

Now regarding javax.persistence.Query vs org.hibernate.Query.

That depends very much of what are your goals.

If you plan to stay with Hibernate in your project, use org.hibernate.Query, as it provides more useful methods that the standard interface. But if you plan to switch to another provider, like EclipseLink, you should use the standard interface for both, which is javax.persistence.Query.