NamedNativeQuery之间的区别

NamedNativeQuery之间的区别

本文介绍了JPA-EclipseLink中@NamedQuery和@NamedNativeQuery之间的区别的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,我是使用持久性API的新手,并且还阅读了与之相关的几篇文章,并且在这两者之间了解甚少.下面的帖子确实帮助我清除了@NamedQuery的概念什么是命名查询?我现在想了解NamedQuery之间的所有重要关键区别和NamedNativeQuery,在处理JPA-QL和性能方面,哪一个是首选.

Hi I am a newbie using persistence API, and have also read few posts related to the same and got a very few understanding between these two. the below post really helped me clear my concepts for @NamedQueryWhat is a named query? I now wanted to learn all the important key differences between NamedQuery and NamedNativeQuery, and which one is preferred most while dealing with JPA-QL, and performance wise.

谢谢!

推荐答案

原生查询不是 JPQL.持久性提供程序将常规查询转换为基础持久性系统可以理解的内容(例如SQL SELECT或NoSQL检索).本机查询虽然不是可移植的,但直接用商店的本机语言编写的,因此您可以使用特殊功能(例如PostgreSQL的IP地址操作),但会花费可移植性.

A native query isn't JPQL. A regular query is converted by the persistence provider into something the underlying persistence system understands (such as SQL SELECT, or a NoSQL retrieval). A native query, while not portable, is written directly in the native language of the store so that you can use special features (like PostgreSQL's IP address manipulation) at the cost of portability.

这篇关于JPA-EclipseLink中@NamedQuery和@NamedNativeQuery之间的区别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-01 03:35