geronimo-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Adam OGorman <aogor...@ca.ibm.com>
Subject Geronimo 2.0, OpenJPA and DB2
Date Thu, 02 Aug 2007 01:11:34 GMT

I am using the following geronimo-application.xml to deploy an EAR file. The
EAR deploys and starts OK, but the datasource that it creates is called
"jdbc/LunchinatorDataSource" i.e. this is literally the string that shows up
in the admin console, not "LunchinatorDataSource". What is more, the
deployment does not populate the database with the relevant tables, using
openJPA. Are these two things related? Or should I be looking elsewhere to
get openJPA working correctly?

I am using Geronimo 2.0 and DB2 v9.1 on Windows XP

Thanks in advance!


geronimo-application.xml:

<?xml version="1.0" encoding="UTF-8"?>
<application xmlns="http://geronimo.apache.org/xml/ns/j2ee/application-1.2">
  <environment>
    <moduleId>
      <groupId>com.maketechnologies.applications</groupId>
      <artifactId>lunchinator-ear</artifactId>
      <version>2.0</version>
      <type>ear</type>
    </moduleId>

    <dependencies>
            <dependency>
                <groupId>org.apache.geronimo.configs</groupId>
                <artifactId>openjpa</artifactId>
                <type>car</type>
            </dependency>
            <dependency>
                <groupId>org.apache.geronimo.configs</groupId>
                <artifactId>j2ee-corba-yoko</artifactId>
                <type>car</type>
            </dependency>
            <dependency>
                 <groupId>org.apache.geronimo.configs</groupId>
                 <artifactId>system-database</artifactId>
                 <type>car</type>
            </dependency>
            <dependency>
                <groupId>com.ibm.db2</groupId>
                <artifactId>db2jcc</artifactId>
                <version>9.1</version>
                <type>jar</type>
            </dependency>
            <dependency>
                <groupId>com.ibm.db2</groupId>
                <artifactId>db2jcc_license_cu</artifactId>
                <version>9.1</version>
                <type>jar</type>
            </dependency>
     </dependencies>
  </environment>
  
  <module>
        <web>lunchinator-web-2.0.war</web>
        <web-app xmlns="http://geronimo.apache.org/xml/ns/j2ee/web-1.2">
         <context-root>/lunchinator</context-root>
         <!-- This is how we set up JNDI access to EntityManagerFactory -->
         <persistence-unit-ref>
          
<persistence-unit-ref-name>lunchinator/EntityManagerFactory</persistence-unit-ref-name>
           <persistence-unit-name>LunchinatorPU</persistence-unit-name>
         </persistence-unit-ref> 
         </web-app>
    </module>
    
    <module>
        <ejb>lunchinator-domain-2.0.jar</ejb>
        <openejb-jar
xmlns="http://openejb.apache.org/xml/ns/openejb-jar-2.2">
             <enterprise-beans>
              <session>
                  <ejb-name>HelloWorld</ejb-name>                   
                </session>
             </enterprise-beans>
               <persistence xmlns="http://java.sun.com/xml/ns/persistence"
version="1.0">
                <persistence-unit transaction-type="JTA"
name="LunchinatorPU">
                   
<provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider>
                   
<jta-data-source>jdbc/LunchinatorDataSource</jta-data-source>
                   
<non-jta-data-source>jdbc/LunchinatorDataSource</non-jta-data-source>
                    <properties>
                       <property name="openjpa.jdbc.DBDictionary"
value="org.apache.openjpa.jdbc.sql.DB2Dictionary"/> 
                        <!-- Use this if you want to "push" mappings down to
DB (create tables etc) -->
                        <property name="openjpa.jdbc.SynchronizeMappings"
value="buildSchema(ForeignKeys=true)"/>
                         <!-- Use this if you have already created schema 
-->
                        <!-- <property
name="openjpa.jdbc.SynchronizeMappings" value="false" /> -->
                        <property name="openjpa.Sequence"
value="table(Table=OPENJPASEQ, Increment=100)"/> 
                        <property name="openjpa.Log"
value="File=C:\temp\db2openjpa.log, Runtime=TRACE, Tool=INFO, SQL=TRACE"/>
                    </properties>
                </persistence-unit>
            </persistence>   
       </openejb-jar>
    </module> 

    <ext-module>
        <connector>LunchinatorDataSource</connector>
       
<external-path>org.tranql/tranql-connector-db2-embed-xa/1.3/rar</external-path>
 
        <connector
xmlns="http://geronimo.apache.org/xml/ns/j2ee/connector-1.2">
    <resourceadapter>
        <outbound-resourceadapter>
            <connection-definition>
               
<connectionfactory-interface>javax.sql.DataSource</connectionfactory-interface>
                <connectiondefinition-instance>
                    <name>jdbc/LunchinatorDataSource</name>
                    <config-property-setting
name="Password">db2admin</config-property-setting>
                    <config-property-setting
name="UserName">db2admin</config-property-setting>
                    <config-property-setting
name="ServerName">localhost</config-property-setting>
                    <config-property-setting
name="PortNumber">50000</config-property-setting>                    
                    <config-property-setting
name="DatabaseName">testdb</config-property-setting>                    
                    <config-property-setting
name="TraceFile">db2trace.log</config-property-setting>                         
              
                    <connectionmanager>
                        <local-transaction/>
                        <single-pool>
                            <max-size>10</max-size>
                            <min-size>0</min-size>
                            <match-one/>
                        </single-pool>
                    </connectionmanager>
                </connectiondefinition-instance>
            </connection-definition>
        </outbound-resourceadapter>
    </resourceadapter>
        </connector>
    </ext-module> 
  
</application>


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">
	<persistence-unit transaction-type="JTA" name="LunchinatorPU">
	        <jta-data-source>jdbc/LunchinatorDataSource</jta-data-source>
                
<non-jta-data-source>jdbc/LunchinatorDataSource</non-jta-data-source> 
		<class>com.maketechnologies.lunchinator.domain.BaseEntity</class>
		<class>com.maketechnologies.lunchinator.domain.Comment</class>
		<class>com.maketechnologies.lunchinator.domain.Restaurant</class>
		<class>com.maketechnologies.lunchinator.domain.Vote</class>
                <exclude-unlisted-classes>true</exclude-unlisted-classes>
	</persistence-unit>
</persistence>
-- 
View this message in context: http://www.nabble.com/Geronimo-2.0%2C-OpenJPA-and-DB2-tf4203557s134.html#a11956746
Sent from the Apache Geronimo - Users mailing list archive at Nabble.com.


Mime
View raw message