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。

关于注解-Hebernate与JPA(java persistence api)的更多相关文章

  1. Java Persistence API(转)

    定义 Java Persistence API JPA通过JDK 5.0注解或XML描述对象-关系表的映射关系,并将运行期的实体对象持久化到数据库中.[编辑本段]起源 Sun引入新的JPA ORM规范 ...

  2. JPA(Java Persistence API)Java持久化API-介绍

    JPA全称: Java Persistence API JPA的宗旨是为POJO提供持久化标准规范,能够脱离容器独立运行,很方便开发和测试.JPA通过JDK 5.0注解或XML描述对象-关系表的映射关 ...

  3. JAVA PERSISTENCE API (JPA)

    13.2.1. About JPA The Java Persistence API (JPA) is the standard for using persistence in Java proje ...

  4. Java EE (4) -- Java EE 6 Java Persistence API Developer Certified Expert(1z0-898)

    Overview of the Java Persistence API Describe the basics of Object Relational Mapping (ORM) Define t ...

  5. Hibernate操作指南-搭建一个简单的示例(基于Java Persistence API JPA)

  6. JPA(java持久化API)的环境的搭建

    因为我使用的是java工程 所以需要引入的依赖有: <properties> <project.build.sourceEncoding>UTF-8</project.b ...

  7. Java Persistence with MyBatis 3(中国版)

    译者的话 前段时间因为工作和学习的须要,我打算深入研究MyBatis框架.于是在网上查找关于MyBatis的教程,发现国内网上关于MyBatis的教程资料少得可怜:除了MyBatis官网上的用户使用手 ...

  8. Java Persistence with MyBatis 3(中文版) 第二章 引导MyBatis

    MyBatis最关键的组成部分是SqlSessionFactory,我们可以从中获取SqlSession,并执行映射的SQL语句.SqlSessionFactory对象可以通过基于XML的配置信息或者 ...

  9. Java Persistence with MyBatis 3(中文版) 第一章 MyBatis入门

    本章将涵盖以下话题: ž  MyBatis是什么? ž  为什么选择MyBatis? ž  MyBatis安装配置 ž  域模型样例 1.1 MyBatis是什么 MyBatis是一个简化和实现了Ja ...

随机推荐

  1. C学习笔记-数组

    数组的概念 数组是一组具有相同数据类型的变量集合,这里要注意两点,数组只能存储相同的数据类型和数组的内存是连续的,这位数组和指针的联系奠定了基础. 一维数组 定义及初始化 一维数组指的是只有一个下标的 ...

  2. 论文阅读 | Text Processing Like Humans Do: Visually Attacking and Shielding NLP Systems

    [code&data] [pdf] 主要工作 文章首先证明了对抗攻击对NLP系统的影响力,然后提出了三种屏蔽方法: visual character embeddings adversaria ...

  3. Oracle-DQL 7- 集合操作

    集合操作: --将查询结果看作是一个集合,可以将多个查询结果之间用集合操作找出特点的数据--很多的集合操作可以使用条件的组合进行代替,集合操作的效率高于条件组合--某些复杂的查询结果只能通过集合操作得 ...

  4. jQuery添加/删除Select的Option项

    使用语法1. $("#select_id").append("<option value='Value'>Text</option>") ...

  5. 南昌网络赛C.Angry FFF Party

    南昌网络赛C.Angry FFF Party Describe In ACM labs, there are only few members who have girlfriends. And th ...

  6. LG P2822 NOIP2016D2T1 组合数问题

    一句话题意 给定n.m和k,求对于所有的i(0<=i<=n)和j(0<=j<=min(i,m)),有多少对(i,j)使\(C_i^j\)使k的倍数 数据范围 部分分.满分做法和 ...

  7. VC++2017关于项目出现"const char *" 类型的实参与 "char *" 类型的形参不兼容错误的解决方法

    C++项目中经常会定义如下形式的字符串: char *texts[] = { "1. Open Account", "2. To Deposit Money", ...

  8. php链接redis (带密码)常用的redis方法

    连接redis $redis = new Redis(); $redis->connect($host, $port); $redis->auth('my pass'); //密码验证 常 ...

  9. phpQuery简介

    接上一篇,使用 Snoopy 抓取回来网页之后,需要解析网页中的元素,但是对于 https://www.cnblogs.com/hellowzd/p/5163276.html

  10. 运用加密技术保护Java源代码(转)

    出处:运用加密技术保护Java源代码 为什么要加密? 对于传统的C或C++之类的语言来说,要在Web上保护源代码是很容易的,只要不发布它就可以.遗憾的是,Java程序的源代码很容易被别人偷看.只要有一 ...