`

JPA学习指南 ( by quqi99 )

 
阅读更多

JPA学习指南 ( by quqi99 )


作者:张华 发表于:2011-04-07

版权声明:可以任意转载,转载时请务必以超链接形式标明文章原始出处和作者信息及本版权声明

( http://blog.csdn.net/quqi99 )

h1 { margin-top: 0.6cm; margin-bottom: 0.58cm; line-height: 200%; page-break-inside: avoid; }h1.western { font-family: "Times New Roman",serif; font-size: 22pt; }h1.cjk { font-family: "Arial Unicode MS"; font-size: 22pt; font-style: normal; font-weight: bold; }h1.ctl { font-size: 22pt; font-weight: bold; }h2 { margin-top: 0.46cm; margin-bottom: 0.46cm; line-height: 173%; page-break-inside: avoid; }h2.western { font-family: "Arial",sans-serif; font-size: 16pt; }h2.cjk { font-family: "黑体","SimHei"; font-size: 16pt; font-style: normal; }h2.ctl { font-family: "Tahoma"; font-size: 16pt; }h3 { margin-top: 0.46cm; margin-bottom: 0.46cm; line-height: 173%; page-break-inside: avoid; }h3.western { font-family: "Times New Roman",serif; font-size: 16pt; }h3.cjk { font-family: "Arial Unicode MS"; font-size: 16pt; font-style: normal; }h3.ctl { font-family: "Tahoma"; font-size: 16pt; }p { margin-bottom: 0.21cm; }a:link { color: rgb(0, 0, 255); }

1 JPA 是什么

What is JPA ? 我们不扯专业术语,这样说吧,大家可能不知道JPA, 但大家都知道HibernateDao 、实体EJB 。对,JPA 就是类似于它们的一个东东,用于数据存储层的一套规范。

JPA 的全称是Java Persistence API, Java EE 5.0 平台标准中的ORM 规范。

既然有了Hibernate ,有了实体EJB ,为什么还要引入JPA 呢,用它有什么好处呢?Sun 引入新的JPA ORM 规范出于两个原因:其一,简化现有Java EEJava SE 应用的对象持久化的开发工作;其二,Sun 希望整合对ORM 技术,实现天下归一。、

JPAEJB 3.0 软件专家组开发,作为JSR-220 实现的一部分。但它不囿于EJB 3.0你可以在Web 应用、甚至桌面应用中使用JPA 的宗旨是为POJO 提供持久化标准规范,由此可见,经过这几年的实践探索,能够脱离容器独立运行,方便开发和测试的理念已经深入人心了。

2 JPA 的实现

目前Hibernate 3.2TopLink 10.1.3 以及OpenJpa 都提供了JPA 的实现。

  • JBoss 集成的是Hibernate 的实现

  • Geronimo 集成的是OpenJpa 的实现

  • GlassFish 集成的是TopLink 的实现

JPA 的总体思想和现有HibernateTopLinkJDOORM 框架大体一致。总的来说,JPA 包括以下3 方面的技术:

  • ORM 映射元数据,JPA 支持XMLJDK 5.0 注解两种元数据的形式,元数据描述对象和表之间的映射关系,框架据此将实体对象持久化到数据库表中;

  • JPA API ,用来操作实体对象,执行CRUD 操作,框架在后台替我们完成所有的事情,开发者从繁琐的JDBCSQL 代码中解脱出来。

  • 查询语言,这是持久化操作中很重要的一个方面,通过面向对象而非面向数据库的查询语言查询数据,避免程序的SQL 语句紧密耦合。

3 一个实例

3.1 数据库准备

Oracle 中建一个表,表名: student

它有两个字段:

Id int

Name varchar

3.2 POJO

package com. quqi99 .testsuite.jpa;

import java.io.Serializable;

import javax.persistence.Entity;

import javax.persistence.Id;

/**

* @version 0.10 2009 - 6 - 1

* @author Zhang Hua

*/

@Entity

public class Student implements Serializable {

private static final long serialVersionUID = 1L;

private int id ;

private String name ;

@Id

public int getId() {

return id ;

}

public void setId( int id) {

this . id = id;

}

public String getName() {

return name ;

}

public void setName(String name) {

this . name = name;

}

}

其中 @Entity 属性代表对应数据库中一个同名的(student)

@Id 代表该字段是主键

此为一个简单的例子,只为了说明如何在各应用服务器中部署JPA ,更详细的学习可以见后面的介绍

3.3 DAO

package com.quqi99.testsuite.jpa;

import javax.persistence.EntityManager;

import javax.persistence.EntityManagerFactory;

import javax.persistence.Persistence;

/**

* @version 0.10 2009 - 6 - 1

* @author Zhang Hua

*/

public class StudentDao {

public StudentDao(){

}

public Student findById(String id){

EntityManager em = null ;

try {

EntityManagerFactory emf = Persistence. createEntityManagerFactory ( "jpaUnit" );

em = emf.createEntityManager();

return em.find(Student. class , Integer. parseInt (id));

} catch (Exception e){

e.printStackTrace();

} finally {

if (em!= null )

em.close();

}

return null ;

}

}

直接通过Persistence. createEntityManagerFactory ( "jpaUnit" ) 语句可以取到容器维护的EntityManagerFactory ,这要求配置persistence.xml 文件,这将要后面介绍.

3.4 Servlet 调用

package com.quqi99.testsuite.jpa;

import java.io.IOException;

import java.io.PrintWriter;

import javax.servlet.ServletException;

import javax.servlet.http.HttpServlet;

import javax.servlet.http.HttpServletRequest;

import javax.servlet.http.HttpServletResponse;

/**

* @version 0.10 2009 - 6 - 1

* @author Zhang Hua

*/

//@PersistenceContext(name="persistence/jpaJNDI", unitName="jpaUnit")

public class JpaServlet extends HttpServlet {

private static final long serialVersionUID = 1L;

// // 以这种注入的方式会导致多个线程共用同一个PersistenceContext

// @PersistenceContext(unitName="jpaUnit")

// private EntityManager em ;

private static StudentDao studentDao ;

public JpaServlet() {

}

public void destroy() {

super .destroy();

}

public void doGet(HttpServletRequest request, HttpServletResponse response)

throws ServletException, IOException {

doPost(request, response);

}

public void doPost(HttpServletRequest request, HttpServletResponse response)

throws ServletException, IOException {

response.setContentType( "text/html" );

PrintWriter out = response.getWriter();

try {

String id = request.getParameter( "id" );

if (id == null )

id = "1" ;

Student student = studentDao .findById(id);

out.println(student.getId() + ": " + student.getName());

} catch (Exception e) {

out.println(e.getMessage());

e.printStackTrace();

}

out.flush();

out.close();

}

public void init() throws ServletException {

try {

// // 通过JNDI 查找, 注意上面的@PersistenceContext(name="persistence/jpaJNDI", unitName="jpaUnit")

// Context envCtx = (Context)new InitialContext().lookup("java:comp/ env ");

// EntityManager em = (EntityManager) envCtx.lookup("persistence/jpaJNDI");

// System.out. println (" em :" + em );

studentDao = new StudentDao();

} catch (Exception e) {

e.printStackTrace();

throw new ServletException( " EntityManagerFactory 出错啦:" + e.getMessage());

}

}

}

4 在应用服务器中部署

4.1 建数据源

配置JNDI 名为:jdbc/testsuitedb 的数据源。

GlassFish

  1. 启动GlassFish

  1. 进控制台,http://localhost:4848

用户名:admin 密码:adminadmin

  1. 在左侧 Resouces---JDBC---Connection Pools 中新建一个连接池,相关信息如下:

  1. 在左侧 Resouces---JDBC---Resources 为该连接池命名一个JNDI 名字。

JBoss

E:/java/jboss-5.1.0.Beta1/server/default/deploy 目录新建oracle-ds.xml 文件,内容如下:

<?xml version="1.0" encoding="UTF-8"?>

<!-- ===================================================================== -->

<!-- -->

<!-- JBoss Server Configuration -->

<!-- -->

<!-- ===================================================================== -->

<!-- $Id: oracle-ds.xml 23720 2004-09-15 14:37:40Z loubyansky $ -->

<!-- ==================================================================== -->

<!-- Datasource config for Oracle originally from Steven Coy -->

<!-- ==================================================================== -->

<datasources>

<local-tx-datasource>

<jndi-name>jdbc/testsuitedb</jndi-name>

<connection-url>jdbc:oracle:thin:@192.168.1.51:1521:oracledb</connection-url>

<!--

Here are a couple of the possible OCI configurations.

For more information, see http://otn.oracle.com/docs/products/oracle9i/doc_library/release2/java.920/a96654/toc.htm

<connection-url>jdbc:oracle:oci:@youroracle-tns-name</connection-url>

or

<connection-url>jdbc:oracle:oci:@(description=(address=(host=youroraclehost)(protocol=tcp)(port=1521))(connect_data=(SERVICE_NAME=yourservicename)))</connection-url>

Clearly, its better to have TNS set up properly.

-->

<driver-class>oracle.jdbc.driver.OracleDriver</driver-class>

<user-name>system</user-name>

<password>password</password>

<!-- Uses the pingDatabase method to check a connection is still valid before handing it out from the pool -->

<!--valid-connection-checker-class-name>org.jboss.resource.adapter.jdbc.vendor.OracleValidConnectionChecker</valid-connection-checker-class-name-->

<!-- Checks the Oracle error codes and messages for fatal errors -->

<exception-sorter-class-name>org.jboss.resource.adapter.jdbc.vendor.OracleExceptionSorter</exception-sorter-class-name>

<!-- sql to call when connection is created

<new-connection-sql>some arbitrary sql</new-connection-sql>

-->

<!-- sql to call on an existing pooled connection when it is obtained from pool - the OracleValidConnectionChecker is prefered

<check-valid-connection-sql>some arbitrary sql</check-valid-connection-sql>

-->

<!-- corresponding type-mapping in the standardjbosscmp-jdbc.xml (optional) -->

<metadata>

<type-mapping>Oracle10g</type-mapping>

</metadata>

</local-tx-datasource>

</datasources>

Geronimo

  1. 进控制台:http://localhost:8180/console

用户名:system 密码: manager

  1. 点击左侧: Services---Repository 上传Oracle 驱动的JAR 包。

上图中Group,Aritfact, Version, Type 的内容随便填

  1. 点击左侧: Services---Database Pools ,在展开的页面中点击“Using the Geronimo database pool wizard 链接,如下图:

注意:Driver Jar 中选择的是你在上一步中 Services---Repository 上传Oracle 驱动的JAR 包信息

4.2 persistence.xml

src/META-INF 目录下新建persistence.xml 文件,内容如下:

GlassFish

<? xml version="1.0" encoding="UTF-8"?>

<persistence version="1.0"

xmlns ="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd">

<persistence-unit name="jpaUnit" transaction-type="JTA">

<jta-data-source> jdbc / testsuitedb </jta-data-source>

<class> com . quqi99 . testsuite . jpa .Student</class>

<properties>

<property name=" toplink .logging.level" value="FINE"/>

<!--

<property name=" toplink . jdbc .driver" value="oracle. jdbc .driver.OracleDriver"/>

<property name=" toplink . jdbc . url " value="jdbc:oracle:thin:@192.168.1.43:1521: orcl "/>

<property name=" toplink . jdbc .password" value="manager"/>

<property name=" toplink . jdbc .user" value="system"/>

-->

</properties>

</persistence-unit>

</persistence>

JBoss

<? xml version="1.0" encoding="UTF-8"?>

<persistence version="1.0"

xmlns ="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd">

<persistence-unit name="jpaUnit" transaction-type="RESOURCE_LOCAL">

<jta-data-source> jdbc / testsuitedb </jta-data-source>

<class> com . quqi99 . testsuite . jpa .Student</class>

<properties>

<!-- JDBC

<property name=" hibernate .connection.driver_class" value="oracle. jdbc .driver.OracleDriver" />

<property name=" hibernate .connection. url " value="jdbc:oracle:thin:@192.168.1.43:1521: orcl " />

<property name=" hibernate .connection. username " value="system" />

<property name=" hibernate .connection.password" value="manager" />

-->

<property name=" hibernate .dialect" value=" org . hibernate .dialect.Oracle10gDialect" />

<property name=" hibernate .show_sql" value="false" />

</properties>

</persistence-unit>

</persistence>

Geronimo

<? xml version="1.0" encoding="UTF-8"?>

<persistence version="1.0"

xmlns ="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd">

<persistence-unit name="jpaUnit" transaction-type="JTA">

<!-- doc : Using a Third-Party DataSource http://openjpa.apache.org/builds/1.0.2/apache-openjpa-1.0.2/docs/manual/ref_guide_dbsetup_thirdparty.html -->

<jta-data-source> jdbc / testsuitedb </jta-data-source>

<class> com . quqi99 . testsuite . jpa .Student</class>

<properties>

<property name=" openjpa .ConnectionDriverName" value="oracle. jdbc .driver.OracleDriver"/>

<property name=" openjpa .ConnectionURL" value="jdbc:oracle:thin:@192.168.1.51:1521: oracledb "/>

<property name=" openjpa .ConnectionUserName" value="system"/>

<property name=" openjpa .ConnectionPassword" value="password"/>

<property name=" openjpa .ConnectionFactoryProperties" value="QueryTimeout=5000"/>

</properties>

</persistence-unit>

</persistence>

5 深入 JPA 注解学习

5.1 如何获得 EntityManager

方法一

在上面的例子中,我们是采用如下代码获得的EntityManager

EntityManagerFactory emf = Persistence. createEntityManagerFactory ( "jpaUnit" );

EntityManager em = emf.createEntityManager();

这种方式EntityManagerFactory 是从容器中取出来的,是由容器维护的,我们不需要管它,但是EntityManager 却是我们自己建的,那么我们得自己负责用完它后的关闭。

方法二

第二种方式,可以通过注入的方式,代码如下:

@PersistenceContext(unitName="jpaUnit")

private EntityManager em ;

这种方式,应该在一个线程安全的类中注入,然后传值到它要使用的类。如果在一个线程不安全的类中注入的话,可能会造成此类的多个实例,会不安全哦。

方法三

第三种方式,通过JNDI 方式查找。首先在类的开始以源代码注释的形式为该EntityManager 声明一个JNDI 名,如下:

@persistenceContext(name=”persistence/jpaJNDI”, unitName=”jpaUnit”)

当然,这种声明也可以改在web.xml 文件中配置,略。

最后通过JNDI 查找,如下:

Context envCtx = (Context)new InitialContext().lookup("java:comp/ env ");

EntityManager em =

(EntityManager) envCtx.lookup("persistence/jpaJNDI");

5.2 一对多的映射

上面例子中我们用了最简单的,下面,我们讲一个复杂一点的一对多的例子, 一对一,多对多的与这个类例

5.2.1 领域对象

Topic 是论坛的主题,而PollTopic 是调查性质的论坛主题,它扩展于Topic ,一个调查主题拥有多个选项PollOption 。这三个领域对象很好地展现了领域对象之间继承和关联这两大核心的关系。

5.2.2 数据库

上面的3 个领域对象将被映射到数据库的两张表中:


其中,Topic 及其子类PollTopic 将映射到同一张t_topic 表中,并用topic_type 字段区分两者。而PollOption 映射到t_polloption 中。 具有ORM 元数据的领域对象称为实体(Entity ),按JPA 的规范,实体具备以下的条件:

  • 必须使用javax.persistence.Entity 注解或者在XML 映射文件中有对应的<entity> 元素

  • 必须具有一个不带参的构造函数,类不能声明为final ,方法和需要持久化的属性也不能声明为final

  • 如果游离状的实体对象需要以值的方式进行传递,如通Session bean 的远程业务接口传递,则必须实现Serializable 接口;

  • 需要持久化的属性,其访问修饰符不能是public ,它们必须通过实体类方法进行访问。

5.2.3 代码

package com.quqi99.testsuite.jpa;

import java.io.Serializable;

import javax.persistence.Column;

import javax.persistence.Entity;

import javax.persistence.GeneratedValue;

import javax.persistence.GenerationType;

import javax.persistence.Id;

import javax.persistence.JoinColumn;

import javax.persistence.ManyToOne;

/**

* @version 0.10 2009 - 6 - 1

* @author Zhang Hua

*/

@Entity (name= "T_POLL_OPTION" )

public class PollOption implements Serializable {

private static final long serialVersionUID = 1L;

@Id

@GeneratedValue (strategy = GenerationType. TABLE )

@Column (name = "OPTION_ID" )

private int optionId ;

@Column (name = "OPTION_ITEM" )

private String optionItem ;

@ManyToOne

@JoinColumn (name= "TOPIC_ID" , nullable= false )

private PollTopic pollTopic ;

public int getOptionId() {

return optionId ;

}

public void setOptionId( int optionId) {

this . optionId = optionId;

}

public String getOptionItem() {

return optionItem ;

}

public void setOptionItem(String optionItem) {

this . optionItem = optionItem;

}

public PollTopic getPollTopic() {

return pollTopic ;

}

public void setPollTopic(PollTopic pollTopic) {

this . pollTopic = pollTopic;

}

}

package com.quqi99.testsuite.jpa;

import java.util.HashSet;

import java.util.Set;

import javax.persistence.CascadeType;

import javax.persistence.Column;

import javax.persistence.DiscriminatorValue;

import javax.persistence.Entity;

import javax.persistence.OneToMany;

/**

*

*

* @version 0.10 2009 - 6 - 1

* @author Zhang Hua

*/

@Entity

// 通过DiscriminatorValue 将区分字段TOPIC_TYPE 的值设为2, 由于本类继承自Topic 实体, 其它的元数据信息直接从Topic 获得

@DiscriminatorValue (value = "2" )

public class PollTopic extends Topic {

private static final long serialVersionUID = 1L;

private boolean multiple ;

@Column (name = "MAX_CHOICES" )

private int maxChoices ;

@OneToMany (mappedBy = "pollTopic" , cascade = CascadeType. ALL )

private Set<PollOption> options = new HashSet<PollOption>();

public boolean isMultiple() {

return multiple ;

}

public void setMultiple( boolean multiple) {

this . multiple = multiple;

}

public int getMaxChoices() {

return maxChoices ;

}

public void setMaxChoices( int maxChoices) {

this . maxChoices = maxChoices;

}

public Set<PollOption> getOptions() {

return options ;

}

public void setOptions(Set<PollOption> options) {

this . options = options;

}

}

/**

* 对于继承的实体, javax .persistence.InheritanceType 中定义了3 种策略

*SINGLE_TABLE: 父子类都保存到同一个表中, 通过字段值进行区分. 在我们这里,Topic PollTopic 都保存在T_TOPIC 表中, 通过TOPIC_TYPE 字段进行区分,TOPIC_TYPE=1 代表Topic,TOPIC_TYPE=2 代表PoolTopic

*/

@Entity (name = "T_TOPIC" )

@Inheritance (strategy = InheritanceType. SINGLE_TABLE )

@DiscriminatorColumn (name = "TOPIC_TYPE" , discriminatorType = DiscriminatorType. INTEGER , length = 1)

@DiscriminatorValue (value= "1" )

public class Topic implements Serializable {

private static final long serialVersionUID = 1L;

@Id

@GeneratedValue (strategy = GenerationType. TABLE )

@Column (name = "TOPIC_ID" )

private int topicId ;

@Column (name = "TOPIC_TITLE" , length = 100)

private String topicTitle ;

@Column (name = "TOPIC_TIME" )

@Temporal (TemporalType. DATE )

private Date topicTime ;

@Column (name = "TOPIC_VIEWS" )

private int topicViews ;

public int getTopicId() {

return topicId ;

}

public void setTopicId( int topicId) {

this . topicId = topicId;

}

public String getTopicTitle() {

return topicTitle ;

}

public void setTopicTitle(String topicTitle) {

this . topicTitle = topicTitle;

}

public Date getTopicTime() {

return topicTime ;

}

public void setTopicTime(Date topicTime) {

this . topicTime = topicTime;

}

public int getTopicViews() {

return topicViews ;

}

public void setTopicViews( int topicViews) {

this . topicViews = topicViews;

}

5.3 对大字段的映射

package com.quqi99.testsuite.jpa;

import java.io.Serializable;

import javax.persistence.Basic;

import javax.persistence.Column;

import javax.persistence.Entity;

import javax.persistence.FetchType;

import javax.persistence.Lob;

/**

* JPA 中对 Lob 类型的持久化

*

* @version 0.10 2009 - 6 - 1

* @author Zhang Hua

*/

@Entity (name = "T_POST" )

public class Post implements Serializable {

private static final long serialVersionUID = 1L;

@Lob

@Basic (fetch = FetchType. EAGER )

@Column (name = "POST_TEXT" , columnDefinition = "LONGTEXT NOT NULL" )

private String postText ;

@Lob

@Basic (fetch = FetchType. LAZY )

@Column (name = "POST_ATTACH" , columnDefinition = "BLOB" )

private byte [] postAttach ;

public String getPostText() {

return postText ;

}

public void setPostText(String postText) {

this . postText = postText;

}

public byte [] getPostAttach() {

return postAttach ;

}

public void setPostAttach( byte [] postAttach) {

this . postAttach = postAttach;

}

public static long getSerialVersionUID() {

return serialVersionUID ;

}

}

postText 属性对应T_POST 表的POST_TEXT 字段,该字段的类型是LONTTEXT ,并且非空。JPA 通过@Lob 将属性标注为Lob 类 型。通过@Basic 指定Lob 类型数据的获取策略,FetchType.EAGER 表示非延迟加载,而FetchType. LAZY 表示延迟加载。通过@ColumncolumnDefinition 属性指定数据表对应的Lob 字段类型。

5.4 更多注解学习

TopLink JPA Annotation Reference

http://www.oracle.com/technology/products/ias/toplink/jpa/resources/toplink-jpa-annotations.html

6 EJB3.0 中使用 JPA

以上我们介绍了如何在普通的JAVA 应用中使用JPA ,在EJB3.0 中使用JPA 会比它更容易配置。可随便在网上找些资料,略

8 查询语言

查询语言类例于hibernatehql 语言,略。

分享到:
评论

相关推荐

    实用JPA开发指南----jpa核心技术(关联关系等的配置高级配置)

    实用JPA开发指南实用JPA开发指南实用JPA开发指南实用JPA开发指南实用JPA开发指南实用JPA开发指南实用JPA开发指南实用JPA开发指南

    JPA源文件/jpa学习

    jpa jpa规范 jpa源码 jpa jpa规范 jpa源码

    jpa 全面学习资料

    jpa 全面学习资料 入门 实战 示例 jpa开发手册 JPA_全面讲解 JPA使用入门_基础 JPA学习笔记 JPA注解 JPA简介

    JPA学习文档笔记

    JPA入门学习笔记,包含实体表的关联映射

    JPA学习中文文档

    JPA包括以下3方面的技术: RM映射元数据,JPA支持XML和JDK 5.0注解两种元数据的形式,元数据描述对象和表之间的映射关系,框架据此将实体对象持久化到数据库表中; JPA 的API,用来操作实体对象,执行CRUD操作,框架...

    JPA学习资料 JPA学习资料

    1.JPA概述 JPA(Java Persistence API)作为 Java EE 5.0 平台标准的 ORM 规范,将得到所有 Java EE 服务器的支持。Sun 这次吸取了之前 EJB 规范惨痛失败的经历,在充分吸收现 有 ORM 框架的基础上,得到了一个易于...

    jpa学习路线图 Java持久层API

    JPA是Java Persistence API的简称,中文名Java持久层API,是JDK 5.0注解或XML描述对象-关系表的映射关系,并将...尚硅谷jpa学习路线图思维导图,涵盖了jpa框架从基础知识到高级应用的内容,帮助大家尽快掌握jpa开发。

    Java JPA 学习资料 合集

    JPA 规范部分详细的介绍了 JPA 中实体 Bean 的定义,并介绍了实体 Bean 支持的注释、全新的查询语言、实体管理接口、容器实现规范等内容。 JPA 标准制定过程中充分吸收了目前已经出现的所有持久化技术的所有优点,...

    JPA_学习过程整理

    最近比较清闲,终于有空好好把传智的jpa视频整理了一些,因为每次复习都看视频比较麻烦,索性自己整理一份文档,方便查看。 针对jpa入门级概念做了解释; 有一些基本的增删改查例子,及...重点学习一对多,多对多关系;

    JPA学习代码资料

    这是一个jpa(hibernate)的学习代码,是我学习JPA的总结,包含三个案例,一对一、一对多、多对多 。 eclipse工具编码为utf-8

    JPA学习笔记(高手笔记录)

    JPA学习笔记

    JPA学习资料与例子

    JPA JPA学习资料 JPA学习资料与例子,希望对你有帮助

    jpa学习笔记

    java jee技术,jpa的使用接受学习笔记。

    pring date jpa中文指南文档

    pring date jap 中文指南文档pring date jap 中文指南文档pring date jap 中文指南文jap 中文指南文档pring date jap 中文指南文档

    传智播客——JPA学习笔记

    传智播客——JPA学习笔记 网络上有一份pdf格式的《JPA学习笔记》,但是内容排版有点乱,而且有缺失的部分,小弟从原来的blog处拷贝出来,并加以排版,制作成了chm格式的,大家应该知道chm格式比较适合作为参考资料或...

    JPA学习笔记-EJB-04JPA关联映射总结

    JPA学习笔记-EJB-04JPA关联映射总结 JPA JPA关联映射JPA学习笔记-EJB-04JPA关联映射总结 JPA JPA关联映射

    JPA学习笔记

    jpa入门级教程,有jpa基础,环境搭建,常用注解,jpa映射,以及jpql介绍和常见异常.

    Spring Data JPA学习

    Spring Data JPA学习以及配置步骤

    jsf、openJpa学习

    jsf 入门知识 ,jsf标签,jsf与openJpa整合,jsf与Spring整合

    JPA学习大全.docx

    Spring Data JPA 是 Spring 基于 ORM 框架、JPA 规范的基础上封装的一套JPA应用框架,可使开发者用极简的代码即可实现对数据库的访问和操作。...学习并使用 Spring Data JPA 可以极大提高开发效率!

Global site tag (gtag.js) - Google Analytics