Hi altogether, i am using OpenEJB 3.x as standalone edition for JUnit tests and i tried to get OpenEJB Examples running on Tomcat 6.0.x. on Oracle 10g.
I have problems configuring the persistence units and/or datasources. I am not quite sure what the problem is: persistence.xml: <?xml version="1.0" encoding="UTF-8"?> <persistence version="1.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_1_0.xsd"> <!-- only one persistence unit per project by JPA Tools supported --> <!-- <persistence-unit name="JPATestProject"> </persistence-unit> --> <persistence-unit name="beds_pu" transaction-type="JTA"> <provider>org.hibernate.ejb.HibernatePersistence</provider> <jta-data-source>OracleORCL</jta-data-source> <non-jta-data-source>OracleORCLUnmanaged</non-jta-data-source> <class>info.toerber.beds.model.Test</class> </persistence-unit> </persistence> in one of my session beans i am declaring a datasource like: @Resource(name="OracleORCL") DataSource dataSource; In standalone for JUnit-Test it seems to be that OpenEJB always takes its default Database HSQL. Is this correct? Is it possible to change this to an Oracle Datasource? here is my openejb.xml in META-INF for standalone and in <tomcat>/conf for Tomcat deployment: <openejb> <Resource id="OracleORCL" type="DataSource"> # Oracle example # # This connector will not work until you download the driver at: # http://otn.oracle.com/software/tech/java/sqlj_jdbc/content.html JdbcDriver oracle.jdbc.OracleDriver JdbcUrl jdbc:oracle:thin:@192.168.2.96:1521:ORCL UserName openejb Password openejb JtaManaged true </Resource> <Resource id="OracleORCLUnmanaged" type="DataSource"> # Oracle example # # This connector will not work until you download the driver at: # http://otn.oracle.com/software/tech/java/sqlj_jdbc/content.html JdbcDriver oracle.jdbc.OracleDriver JdbcUrl jdbc:oracle:thin:@192.168.2.96:1521:ORCL UserName openejb Password openejb JtaManaged false </Resource> </openejb> The examples are running in Tomcat, but always on HSQL as i can see with if (this.entityManager != null) { Object delegate = this.entityManager.getDelegate(); if (delegate instanceof HibernateEntityManager) { HibernateEntityManager hibernateEntityManager = (HibernateEntityManager) delegate; Session s = hibernateEntityManager.getSession(); Connection conn = s.connection(); inspectConnection(conn); private void inspectConnection(Connection conn) throws SQLException { DatabaseMetaData dataBaseMetaData = conn.getMetaData(); // The drivers are included with OpenEJB 3.0 and HSQLDB is the default database. System.out.println(dataBaseMetaData.getDatabaseMajorVersion()); System.out.println(dataBaseMetaData.getDatabaseMinorVersion()); System.out.println(dataBaseMetaData.getDatabaseProductName()); System.out.println(dataBaseMetaData.getDatabaseProductVersion()); System.out.println(dataBaseMetaData.getDefaultTransactionIsolation()); System.out.println(dataBaseMetaData.getDriverMajorVersion()); System.out.println(dataBaseMetaData.getDriverMinorVersion()); System.out.println(dataBaseMetaData.getDriverName()); System.out.println(dataBaseMetaData.getDriverVersion()); I could change the default Persistence Provider, but it's not running on my Oracle Datasource. Looked in the documentation and i can see that HSQL is the default database. But how and where can i change it always or for a specific persistence unit or for a resource in standalone and/or Tomcat? Btw. the persistence unit works if i take this in Eclipse JPA Tools: persistence.xml: <?xml version="1.0" encoding="UTF-8"?> <persistence version="1.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_1_0.xsd"> <!-- only one persistence unit per project by JPA Tools supported --> <!-- <persistence-unit name="JPATestProject"> </persistence-unit> --> <persistence-unit name="beds_pu" transaction-type="RESOURCE_LOCAL"> <provider>org.hibernate.ejb.HibernatePersistence</provider> <!-- use persistence.xml right mouse Synchronize classes to get actual list --> <class>info.toerber.beds.model.Test</class> <properties> <property name="hibernate.dialect" value="org.hibernate.dialect.Oracle10gDialect"/> <property name="hibernate.connection.driver_class" value="oracle.jdbc.OracleDriver"/> <property name="hibernate.connection.username" value="openejb"/> <property name="hibernate.connection.password" value="openejb"/> <property name="hibernate.connection.url" value="jdbc:oracle:thin:@192.168.2.96:1521:ORCL"/> <property name="hibernate.max_fetch_depth" value="3"/> <!-- JPA Tools looks for this setting(?), so does not always drop the table as announced --> <property name="hibernate.hbm2ddl.auto" value="update" /> <!-- creates table at start and drops at the end!! <property name="hibernate.hbm2ddl.auto" value="create-drop" /> --> <!-- cache configuration <property name="hibernate.ejb.classcache.org.hibernate.ejb.test.Item" value="read-write"/> <property name="hibernate.ejb.collectioncache.org.hibernate.ejb.test.Item.distributors" value="read-write, RegionName"/> --> <!-- alternatively to <class> and <property> declarations, you can use a regular hibernate.cfg.xml file --> <!-- property name="hibernate.ejb.cfgfile" value="/org/hibernate/ejb/test/hibernate.cfg.xml"/ --> </properties> </persistence-unit> </persistence> Any help welcome. Thanks in advance. Jens Toerber -- View this message in context: http://www.nabble.com/OpenEJB-on-Oracle-tp20294024p20294024.html Sent from the OpenEJB User mailing list archive at Nabble.com.