简体   繁体   中英

hibernate with jBoss - Must support JDBC driver

I'm trying to use hibernate with the following persistence xml:

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

<persistence>
<persistence-unit name="eCadWsUnit" transaction-type="JTA">
<class>be.fgov.health.ecad.domain.request.ApplicantIdentityDomain</class>
  <class>be.fgov.health.ecad.domain.request.ApplicationIdentificationDomain</class>
  <class>be.fgov.health.ecad.domain.request.DocumentIdentificationDomain</class>
  <class>be.fgov.health.ecad.domain.request.RequestDomain</class>
  <properties>
     <property name="javax.persistence.jdbc.driver" value="oracle.jdbc.driver.OracleDrive"/>
     <property name="javax.persistence.jdbc.user" value="???"/>
     <property name="javax.persistence.jdbc.password" value="???"/>
     <property name="javax.persistence.jdbc.url" value="jdbc:oracle:?????"/>
     <property name="hibernate.dialect" value="org.hibernate.dialect.Oracle10gDialect"/>
     <property name="hibernate.max_fetch_depth" value="3"/>
     <property name="hibernate.hbm2ddl.auto" value="create"/>
  </properties>

ERROR [org.hibernate.tool.hbm2ddl.SchemaExport] (MSC service thread 1-8) HHH000231: Schema export unsuccessful: java.lang.UnsupportedOperationException: The application must supply JDBC connections
at org.hibernate.service.jdbc.connections.internal.UserSuppliedConnectionProviderImpl.getConnection(UserSuppliedConnectionProviderImpl.java:62) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]
at org.hibernate.tool.hbm2ddl.SuppliedConnectionProviderConnectionHelper.prepare(SuppliedConnectionProviderConnectionHelper.java:51) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]
at org.hibernate.tool.hbm2ddl.DatabaseExporter.<init>(DatabaseExporter.java:52) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]
at org.hibernate.tool.hbm2ddl.SchemaExport.execute(SchemaExport.java:368) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]
at org.hibernate.tool.hbm2ddl.SchemaExport.create(SchemaExport.java:305) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]
at org.hibernate.tool.hbm2ddl.SchemaExport.create(SchemaExport.java:294) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]
at org.hibernate.internal.SessionFactoryImpl.<init>(SessionFactoryImpl.java:452) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1737) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]
at org.hibernate.ejb.EntityManagerFactoryImpl.<init>(EntityManagerFactoryImpl.java:84) [hibernate-entitymanager-4.0.1.Final.jar:4.0.1.Final]
at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:904) [hibernate-entitymanager-4.0.1.Final.jar:4.0.1.Final]
at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:889) [hibernate-entitymanager-4.0.1.Final.jar:4.0.1.Final]
at org.hibernate.ejb.HibernatePersistence.createContainerEntityManagerFactory(HibernatePersistence.java:73) [hibernate-entitymanager-4.0.1.Final.jar:4.0.1.Final]
at org.jboss.as.jpa.service.PersistenceUnitServiceImpl.createContainerEntityManagerFactory(PersistenceUnitServiceImpl.java:162) [jboss-as-jpa-7.1.1.Final.jar:7.1.1.Final]
at org.jboss.as.jpa.service.PersistenceUnitServiceImpl.start(PersistenceUnitServiceImpl.java:85) [jboss-as-jpa-7.1.1.Final.jar:7.1.1.Final]
at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811)
at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [rt.jar:1.7.0_71]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [rt.jar:1.7.0_71]
at java.lang.Thread.run(Thread.java:745) [rt.jar:1.7.0_71]

I always get that error and I can't really figure out why this is. Anyone who could help me? I'm using jBoss7..

With the information provided I would guess that you want transaction-type=”RESOURCE_LOCAL” and not transaction-type="JTA" .

But if you need to use JTA you should probably create and refer a XA-Datasource in JBoss .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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