简体   繁体   English

没有找到hibernate逆向工程持久性单元

[英]hibernate reverse engineering persistence unit not found

I havea java maven3 project in Eclipse IDE with jboss tools installed. 我在Eclipse IDE中安装了jboss工具的java maven3项目。 I'm using hibenrate4 我正在使用hibenrate4

I'm triing to setup the hibenrate configuratoin in hibernate view to test hql queries, the problem is that is says that it couldnt find the persistence unit. 我正在试图在hibernate视图中设置hibenrate configuratoin来测试hql查询,问题是它说它无法找到持久性单元。 I have the persistence.xml placed in src/main/resources/META-INF/persistence.xml 我将persistence.xml放在src / main / resources / META-INF / persistence.xml中

is there some maven config that I nead to set? 有什么maven配置我必须设置?

项目结构

hibenrate配置

休眠配置

持久性单元未找到错误

Persistence.xml persistence.xml中

   <persistence-unit  name="ypay">
    <provider>org.hibernate.jpa.HibernatePersistenceProvider</provider>
    <jta-data-source>java:jboss/datasources/ypay</jta-data-source>
    <properties>
     <!-- Properties for Hibernate -->
     <!-- <property name="hibernate.hbm2ddl.auto" value="validate" /> -->
     <property name="hibernate.show_sql" value="false" />
     <property name="hibernate.dialect" value="org.hibernate.dialect.MySQLInnoDBDialect" />  
    </properties>

hibernate.properties hibernate.properties

hibernate.connection.password=
hibernate.connection.username=root
hibernate.connection.driver_class=com.mysql.jdbc.Driver
hibernate.dialect=org.hibernate.dialect.MySQLInnoDBDialect
hibernate.connection.url=jdbc:mysql://****************:3306/ypay?useUnicode=true&amp;characterEncoding=UTF-8
hibernate.connection.provider_class=org.hibernate.connection.DriverManagerConnectionProvider
hibernate.datasource=
hibernate.transaction.manager_lookup_class=

You need a META-INF/persistence.xml with 你需要一个META-INF/persistence.xml

<persistence-unit name="ypay">

(usually put it in WEB-INF/classes/META-INF. When using maven you can try placing it in src/main/resources/META-INF) (通常把它放在WEB-INF / classes / META-INF中。使用maven时你可以尝试将它放在src / main / resources / META-INF中)

Please refer to this doc for details. 有关详细信息,请参阅文档。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM