[jboss-user] [JNDI/Naming/Network] - Problem creating self contained datasource and entity manger

mohitanchlia do-not-reply at jboss.com
Wed Jul 22 12:53:46 EDT 2009


 
Jboss 4.2: 

We are currently having problems with getting EntityManager that is self contained only for .ear environment. Instead what is happening is that even though we have separate persistence.xml in each .ear file still entity manager is not becoming container specific. It's still getting loaded globally. 

Below is the persistence.xml in each .ear file. Datasource also is self contained inside the .ear file. 


  | 
  | <persistence>
  |     <persistence-unit name="EeEM" transaction-type="JTA">
  |     <provider>org.hibernate.ejb.HibernatePersistence</provider>
  |     <jta-data-source>java:/EeDS</jta-data-source>
  |     <properties>
  |         <property name="hibernate.dialect"
  |             value="org.hibernate.dialect.Oracle10gDialect"/>
  |         
  |         <!-- For debugging -->
  |         <!-- 
  |         <property name="hibernate.show_sql" value="true"/>
  |         -->
  |         
  |         <property name="hibernate.connection.driver_class"
  |             value="oracle.jdbc.OracleDriver"/>
  | 
  |         <!--  Workaround for Oracle 10G driver bug -->
  |         <property name="hibernate.jdbc.batch_size" value="0"/>
  |             
  |         
  |         <!-- Enable this is hibernate should be responsible for creating
  |              tables. -->
  |         <!--property name="hibernate.hbm2ddl.auto" value="create"/-->
  |         <property name="hibernate.connection.datasource" value="java:/EeDS"/>
  |         <property name="jboss.entity.manager.jndi.name" value="java:/EntityManagers/EeEM"/>
  |         <property name="jboss.entity.manager.factory.jndi.name" value="java:/EntityManagerFactories/EeEM"/>
  |     </properties>
  |     </persistence-unit>
  | </persistence>
  | 
  | 	 


  | 
  | <datasources>
  |   <local-tx-datasource>
  |     <jndi-name>EeDS</jndi-name>
  |     <track-connection-by-tx/>
  |     <connection-url>...</connection-url>
  |     <connection-property name="SetBigStringTryClob">true</connection-property>
  |     <!--  recommended by Oracle support to avoid ORA-01461 errors -->   
  |     <connection-property name="oracle.jdbc.RetainV9LongBindBehavior">true</connection-property>
  |     <max-pool-size>@JDBC_MAX_POOL_SIZE@</max-pool-size>
  |     <driver-class>oracle.jdbc.OracleDriver</driver-class>
  |     <!-- Uses the pingDatabase method to check a connection is still valid before handing it out from the
  |  pool -->
  |     <valid-connection-checker-class-name>org.jboss.resource.adapter.jdbc.vendor.OracleValidConnectionChecker</valid-connection-checker-class-name>
  |     <!-- Checks the Oracle error codes and messages for fatal errors -->
  |     <exception-sorter-class-name>org.jboss.resource.adapter.jdbc.vendor.OracleExceptionSorter</exception-sorter-class-name>
  |     <!-- Oracles XA datasource cannot reuse a connection outside a transaction once enlisted in a global 
  | transaction and vice-versa -->
  |     <no-tx-separate-pools/>    
  |         <!-- sql to call when connection is created
  |         <new-connection-sql>some arbitrary sql</new-connection-sql>
  |         -->
  | 
  |         <!-- sql to call on an existing pooled connection when it is obtained from pool - the OracleValidConn
  | ectionChecker is prEered
  |         <check-valid-connection-sql>some arbitrary sql</check-valid-connection-sql>
  |         -->
  | 
  |       <!-- corresponding type-mapping in the standardjbosscmp-jdbc.xml (optional) -->
  |       <metadata>
  |          <type-mapping>Oracle9i</type-mapping>
  |       </metadata>
  |       
  |       <security-domain>EncryptedOracleDbRealm</security-domain>
  |   </local-tx-datasource>
  | 
  | </datasources>
  | 	 
  | 

Above .xml files lives inside each .ear file. Now I expect 2 Entitiy Manger very specific to each .ear file deployment. Instead we are getting only one entity manager - the last one that gets loaded - for entire JVM environment. What can we do to seprate it out. We tries "isolate" of .ear but that doesn't work either. Any example or suggestions will be helpful. 

View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4245374#4245374

Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4245374



More information about the jboss-user mailing list