Ah, I had changed the name in my persistence.xml and I took the wrong stacktrace. There is only one persistence unit defined.
For troubleshooting here's what I've tried:
Code:
<persistence-unit name="DEV" transaction-type="RESOURCE_LOCAL">
<properties>
<property name="hibernate.dialect" value="org.hibernate.dialect.Oracle9Dialect"/>
<property name="hibernate.connection.driver_class" value="oracle.jdbc.driver.OracleDriver"/>
<property name="hibernate.connection.username" value=""/>
<property name="hibernate.connection.password" value=""/>
<property name="hibernate.connection.url" value="jdbc:oracle:thin:@xxx.xxx.xxx.xxx:1521:tns"/>
<property name="hibernate.show_sql" value="true"/>
<property name="hibernate.max_fetch_depth" value="3"/>
<property name="hibernate.cache.provider_class" value="org.hibernate.cache.NoCacheProvider"/>
</properties>
</persistence-unit>
That's pretty much exactly what's in the hibernate documentation and it works well out of container. However, If i drop this ear into a JBoss server that doesn't have this defined as a datasource I get this:
Code:
13:36:26,281 WARN [ServiceController] Problem starting service persistence.units:ear=aoma.ear,unitName=DEV
java.lang.RuntimeException: You have not defined a jta-data-source for a JTA enabled persistence context named: DEV
at org.jboss.ejb3.entity.PersistenceUnitDeployment.start(PersistenceUnitDeployment.java:244)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
...
I expected JBoss to ignore a RESOURCE_LOCAL datasource. Which led me to try adding that non-jta line in there:
Code:
<persistence-unit name="DEV" transaction-type="RESOURCE_LOCAL">
<non-jta-data-source>DEV</non-jta-data-source>
<properties>
<property name="hibernate.dialect" value="org.hibernate.dialect.Oracle9Dialect"/>
<property name="hibernate.connection.driver_class" value="oracle.jdbc.driver.OracleDriver"/>
<property name="hibernate.connection.username" value=""/>
<property name="hibernate.connection.password" value=""/>
<property name="hibernate.connection.url" value="jdbc:oracle:thin:@xxx.xxx.xxx.xxx:1521:tns"/>
<property name="hibernate.show_sql" value="true"/>
<property name="hibernate.max_fetch_depth" value="3"/>
<property name="hibernate.cache.provider_class" value="org.hibernate.cache.NoCacheProvider"/>
</properties>
</persistence-unit>
But that gives the first exception I posted (where my bean is waiting on the second to deploy). It appears that the non-jta-datasource to tell hibernate that it should bind to whatever datasource is specified in there (which makes sense). What I would like to know is if there's a way to make a persistence unit that gets completely ignored by JBoss/hibernate.