What's the difference between javax.persistence.Id and org.springframework.data.annotation.Id?

后端 未结 1 1137
耶瑟儿~
耶瑟儿~ 2021-02-05 02:24

I\'d be interested whether there is the difference between javax.persistence.Id and org.springframework.data.annotation.Id.

  1. If Spring ha
1条回答
  •  再見小時候
    2021-02-05 02:45

    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 is the annotation defined by JPA for all its implementations. Have in mind JPA only applies for management of relational data.

    0 讨论(0)
提交回复
热议问题