JTA vs. Non-JTA
patsch82 Sep 30, 2011 2:57 PMI'm referring to this bug on JBoss AS7: https://hibernate.onjira.com/browse/HHH-6522
The problem is I can't use JTA as I always get a NullPointerException trying to create an EntityManager object. But without JTA nothing is written to my database table using Object.persist()
How do I change this context to Non-JTA correctly? As this is only a development and no productive instance my server runs locally.
Here's my datasource conf:
<datasource jndi-name="HttpTestDS" pool-name="OracleDS" enabled="true" jta="false" use-java-context="true" use-ccm="true"> <connection-url> jdbc:oracle:thin:@localhost:1521:xe </connection-url> <driver> oracle </driver> <pool> <prefill> true </prefill> <use-strict-min> false </use-strict-min> <flush-strategy> FailingConnectionOnly </flush-strategy> </pool> <security> <user-name> XYZuser </user-name> <password> XYZpassword </password> </security> </datasource>
...and my persistence.xml...
<persistence version="2.0" 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"> <persistence-unit name="Interfaces_HTTP_ESP_Test_PersistencePU" transaction-type="RESOURCE_LOCAL"> <non-jta-data-source>java:/HttpTestDS</non-jta-data-source> <mapping-file>META-INF/orm.xml</mapping-file> <properties> <property name="openjpa.DataCache" value="true"/> <property name="openjpa.RemoteCommitProvider" value="sjvm"/> <property name="openjpa.DynamicEnhancementAgent" value="false"/> <property name="openjpa.RuntimeUnenhancedClasses" value="unsupported"/> <property name="openjpa.jdbc.SynchronizeMappings" value="buildSchema(ForeignKeys=true)"/> <property name="openjpa.jdbc.QuerySQLCache" value="true(EnableStatistics=true)"/> </properties> </persistence-unit> </persistence>
.
and just in case if you need that too: orm.xml
<?xml version="1.0" encoding="UTF-8"?> <entity-mappings version="2.0" xmlns="http://java.sun.com/xml/ns/persistence/orm" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence/orm http://java.sun.com/xml/ns/persistence/orm_2_0.xsd"> <entity class="com.wn.csq.interfaces.httpesptest.persistence.dbentities.Debriefing"> </entity> <entity class="com.wn.csq.interfaces.httpesptest.persistence.dbentities.Dbeta"> </entity> <entity class="com.wn.csq.interfaces.httpesptest.persistence.dbentities.Dbline"> </entity> <entity class="com.wn.csq.interfaces.httpesptest.persistence.dbentities.Dbnote"> </entity> <entity class="com.wn.csq.interfaces.httpesptest.persistence.dbentities.Briefing"> </entity> <entity class="com.wn.csq.interfaces.httpesptest.persistence.dbentities.Ibasenote"> </entity> <entity class="com.wn.csq.interfaces.httpesptest.persistence.dbentities.Techniciannote"> </entity> <entity class="com.wn.csq.interfaces.httpesptest.persistence.dbentities.Task"> </entity> <entity class="com.wn.csq.interfaces.httpesptest.persistence.dbentities.Tasklogging"> </entity> <entity class="com.wn.csq.interfaces.httpesptest.persistence.dbentities.Extservprov"> </entity> <entity class="com.wn.csq.interfaces.httpesptest.persistence.dbentities.Tooluser"> </entity> <entity class="com.wn.csq.interfaces.httpesptest.persistence.dbentities.Role"> </entity> </entity-mappings>
Hope that you understand my problem and thanks in forward for your answer!
Greetings,
Patrick