javax.persistence.Id和org.springframework.data.annotation.Id有什么区别? [英] What's the difference between javax.persistence.Id and org.springframework.data.annotation.Id?
问题描述
我想知道javax.persistence.Id
和org.springframework.data.annotation.Id
之间是否有区别.
I'd be interested whether there is the difference between javax.persistence.Id
and org.springframework.data.annotation.Id
.
- 如果Spring仅为支持JPA注释而创建了该注释,那为什么呢?
-
org.springframework.data.annotation.Id
还有其他[附加]用途吗?
- If Spring has created that annotation only for support the JPA annotation, then why?
- Does
org.springframework.data.annotation.Id
have another [additional] purpose?
Spring当前使用
推荐答案
org.springframework.data.annotation.Id
来支持其他非关系持久性数据库或框架的映射,这些数据库或框架没有定义的通用持久性API(如JPA).因此,通常在处理其他spring-data项目(例如spring-data-mongodb,spring-data-solr等)时使用.
org.springframework.data.annotation.Id
is currently used by Spring to support mapping for other non relational persistence databases or frameworks that do not have a defined common persistence API like JPA. So, it is normally used when dealing with other spring-data projects such as spring-data-mongodb, spring-data-solr, etc.
javax.persistence.Id
是JPA为所有实现定义的注释.请记住,JPA仅适用于关系数据的管理.
javax.persistence.Id
is the annotation defined by JPA for all its implementations. Have in mind JPA only applies for management of relational data.
这篇关于javax.persistence.Id和org.springframework.data.annotation.Id有什么区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!