zoukankan      html  css  js  c++  java
  • 关于注解-Hebernate与JPA(java persistence api)

    The JPA spec. defines the JPA annotation in the javax.persistence package. Hibernate not only implements JPA spec , but extends it to adds more features . So , hibernate creates their own annotations which just extend the JPA annotation with the Hibernate features , and put these annotation inside the package org.hibernate.annotations

    If there are no Hibernate specified features added for that JPA annotation (eg @OneToMany and @ManyToOne) , Hibernate will not make that annotation in their org.hibernate.annotations package and you have to use these annotation from javax.persistence according to the JPA specification.

    Normally ,people will use JPA annotations until they come across a situation that requires to use hibernate features.

    In one word: if you want to use hibernate with annotation, you must use some annotations in the javax.persistence package.
     
    Extends:
        1,JPA(Java Persistence API)是Sun官方提出的Java持久化规范。它为Java开发人员提供了一种对象/关系映射工具来管理Java应用中的关系数据。,而Hibernate是它的一种实现。除了Hibernate,还有EclipseLink(曾经的toplink),OpenJPA等可供选择,所以使用Jpa的一个好处是,可以更换实现而不必改动太多代码。

        2,Hibernate作为JPA的一种实现,jpa的注解已经是hibernate的核心,hibernate只提供了一些补充,而不是两套注解。hibernate对jpa的支持够足量,在使用hibernate注解建议使用jpa。
  • 相关阅读:
    python拼接字符串
    SyntaxError: Non-ASCII character 'xe5' in file a.py on line 9, but no encoding declared; see http://www.python.org/peps/pep-0263.html for details
    Python三目运算符
    上一条下一条方案对比
    编程注意
    Running asp net mvc4 on ubuntu
    慎重使用正则
    Web开发注意
    懒人的服务监控
    编辑器选择
  • 原文地址:https://www.cnblogs.com/nickhan/p/4897087.html
Copyright © 2011-2022 走看看