美文网首页FIT5192
JPA持久化配置

JPA持久化配置

作者: __Jingyu__ | 来源:发表于2017-08-03 12:31 被阅读0次
  • 1.首先需要配置服务器glassfish的数据库连接池,又叫资源连接池:
  • 2.然后配置persistence unit:
    • 整个Persistence unit的格式如下:



      -配置实例:

<persistence version="2.1" xmlns="http://xmlns.jcp.org/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/persistence http://xmlns.jcp.org/xml/ns/persistence/persistence_2_1.xsd">
  <persistence-unit name="RealEstateAgencyPU" transaction-type="JTA">
    <jta-data-source>jdbc/RealEstateDataSource</jta-data-source>
    <class>fit5042.tutex.repository.entities.ContactPerson</class>
    <class>fit5042.tutex.repository.entities.Property</class>
    <exclude-unlisted-classes>true</exclude-unlisted-classes>
    <properties>      
      <property name="javax.persistence.schema-generation.database.action" value="create"/>
    </properties>
  </persistence-unit>
</persistence>
  • 其中:



    就是这条:


相关文章

网友评论

    本文标题:JPA持久化配置

    本文链接:https://www.haomeiwen.com/subject/auvylxtx.html