在Glassfish服务器上配置Hibernate JPA 2.0的学习资源 [英] Learning resource for Configuring Hibernate JPA 2.0 on Glassfish server
问题描述
我试图在玻璃鱼服务器上使用休眠和JPA 2.0创建一个新的Java EE项目。你们能否为我提供一些资源来配置上述内容,以便它们可以无缝工作?我尝试过使用netbeans并通过使用hibernate提供程序生成持久化单元,但最终出现此错误:
I am trying to create a new Java EE project using hibernate and JPA 2.0 on the glass fish server. Can you guys provide me some resources to configure the above so that they work seamlessly? I have tried using netbeans and generated the persistence unit by using the hibernate provider, but I end up getting this error:
javax.persistence.PersistenceException: [PersistenceUnit: DBAppPU] Unable to build EntityManagerFactory
推荐答案
<首先,通过更新工具安装Hibernate支持(或者按照 manual procedure )。其次,提供一个JPA 2.0 persistence.xml
来使用Hibernate作为JPA提供者:
First, install Hibernate support via the update tool (or follow the manual procedure). Second, provide a JPA 2.0 persistence.xml
to use Hibernate as JPA provider:
<persistence 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_2_0.xsd" version="2.0">
<persistence-unit name="MyPu" transaction-type="JTA">
<provider>org.hibernate.ejb.HibernatePersistence</provider>
<!-- JNDI name of the database resource to use -->
<jta-data-source>jdbc/__default</jta-data-source>
<properties>
<!-- The database dialect to use -->
<property name="hibernate.dialect" value="org.hibernate.dialect.DerbyDialect" />
<!-- update database tables at deployment -->
<property name="hibernate.hbm2ddl.auto" value="update"/>
<!-- log the generated SQL -->
<property name="hibernate.show_sql" value="true"/>
</properties>
</persistence-unit>
</persistence>
资源
- 使用Hibernate作为JPA Provider for GlassFish V3 (通过更新工具) >
- 使用Hibernate作为Glassfish的持久性提供者(手册程序)
- JPA和Glassfish 3上的Hibernate
- Using Hibernate as JPA Provider for GlassFish V3 (via update tool)
- Use Hibernate as a persistence provider with Glassfish (manual procedure)
- JPA with Hibernate on Glassfish 3
Resources
这篇关于在Glassfish服务器上配置Hibernate JPA 2.0的学习资源的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!