Torai Torai - 1 year ago 125
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 ?

Answer Source

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.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download