Reputation: 1213
When we have to use
createQuery(String),
createNamedQuery(String),
createNativeQuery(String)
in Hibernate and what is the difference between them?
Upvotes: 14
Views: 41261
Reputation: 17734
createQuery:
http://docs.jboss.org/hibernate/core/3.6/reference/en-US/html/objectstate.html#objectstate-querying
http://docs.jboss.org/hibernate/core/3.6/reference/en-US/html/queryhql.html
createNamedQuery:
http://www.mkyong.com/hibernate/hibernate-named-query-examples/
http://www.javalobby.org/java/forums/m91885316.html
createNativeQuery:
http://docs.jboss.org/hibernate/core/3.6/reference/en-US/html/querysql.html
Upvotes: -1
Reputation: 13924
They differ in the meaning of the argument they are called with.
@javax.persistence.NamedQuery
annotation.Upvotes: 4