本文介绍了JPA的EntityManager createQuery()vs createNamedQuery()vs createNativeQuery()的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
任何人都可以向我解释一下JPA的EntityManager的以下方法之间的区别:createQuery(),createNamedQuery()和createNativeQuery()还要说明我在哪种情况下应该使用哪种方法?
Can anyone please explain me the differences between following methods of JPA's EntityManager:createQuery(), createNamedQuery() and createNativeQuery()And also explain me on which cases we should you use which method ?
推荐答案
- CreateQuery: Used to create an JPQL
- createNamedQuery: Used to define queries with name in mapping file or annotation go to this
- createNativeQuery: Used to execute native/pure SQL queries Example
这篇关于JPA的EntityManager createQuery()vs createNamedQuery()vs createNativeQuery()的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!