geronimo-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Gianny Damour <gianny.dam...@optusnet.com.au>
Subject Re: Table database creation
Date Sun, 09 Apr 2006 10:34:15 GMT
There is an Ant task to generate a SQL script to create the underlying 
tables.

The following snippet should get you started (note that you need to 
replace the various ${} with the relevant base location and version 
numbers):

        <taskdef name="ddlExporter" 
classname="org.openejb.deployment.ant.DDLExporterTask">
            <classpath>
                <pathelement 
location="${maven.repo.local}/openejb/jars/openejb-builder-${openejb_version}.jar"/>
                <pathelement 
location="${maven.repo.local}/tranql/jars/tranql-${tranql_version}.jar"/>
                <pathelement 
location="${maven.repo.local}/geronimo/jars/geronimo-kernel-${geronimo_version}.jar"/>
                <pathelement 
location="${maven.repo.local}/geronimo/jars/geronimo-deployment-${geronimo_version}.jar"/>
                <pathelement 
location="${maven.repo.local}/geronimo/jars/geronimo-common-${geronimo_version}.jar"/>
                <pathelement 
location="${maven.repo.local}/geronimo/jars/geronimo-j2ee-schema-${geronimo_version}.jar"/>
                <pathelement 
location="${maven.repo.local}/geronimo/jars/geronimo-service-builder-${geronimo_version}.jar"/>
                <pathelement 
location="${maven.repo.local}/xmlbeans/jars/xbean-${xmlbeans_version}.jar"/>
                <pathelement 
location="${maven.repo.local}/stax/jars/stax-api-${stax_api_version}.jar"/>
            </classpath>
        </taskdef>

        <ddlExporter
            ejbJar="jar:${maven.build.dir}/openejb-cmp2-prefetch.jar"
            openejbJar="jar:${maven.build.dir}/openejb-cmp2-prefetch.jar"
            output="${maven.build.dir}/openejb-cmp2-prefetch.sql"
            ddlCommandBuilder="org.tranql.ddl.DerbyDDLCommandBuilder"
            type="drop-create-constraint">
            <classpath>
                <pathelement location="target/openejb-cmp2-prefetch.jar"/>
            </classpath>
        </ddlExporter>

Note that the ejbJar and openejbJar attributes of the ddlExporter task 
supports various notations:

* ejbJar: location of the ejb-jar.xml file
1. you can specify a jar, e.g. "jar:myEJBModule.jar", and the task will 
look for "META-INF/ejb-jar.xml" within it;
2. you can specify a jar within a jar (this can be useful if you have an 
EJB module within an EAR), e.g. 
"jar:jar:myEARModule.ear!/myEJBModule.jar", and the task will look for 
"META-INF/ejb-jar.xml" within the nested jar; and
3. you can specify the location of a bare ejb-jar.xml file, e.g. 
"META-INF/ejb-jar.xml".

* openejbJar: location of the openejb-jar DD
1. same as ejbJar 1. above;
2. same as ejbJar 2. above;
3. same as ejbJar 3. above;
4. you can specify an openejb-jar nested within a bare 
geronimo-application.xml file, e.g. 
"nested:META-INF/geronimo-application.xml!/0" (0 is the index of the 
nested openejb-jar DD; 0 is the first openejb-jar element defined within 
geronimo-application.xml); and
5. you can specify an openejb-jar nested within a geronimo-application 
file within an EAR module, e.g. "nested:jar:myEARModule.ear!/0".

Thanks,
Gianny

Aaron Mulder wrote:

>I believe there's a command-line or Maven tool to output the table
>create SQL, but we don't do it as part of the deployment process. 
>Gianny would probably know the exact syntax.
>
>Thanks,
>    Aaron
>
>On 4/8/06, Olivier Voutat <olivier.voutat@gmail.com> wrote:
>  
>
>>I saw that jBoss has the capability of creating a database tables based on
>>the Entity Beans that are created inside the container. It is that possible
>>in Geronimo too ?
>>
>>Best Regards,
>>
>>--
>>Olivier Jeanpierre Voutat
>>Rua Praia de Muriú, 9188
>>Cep 59092-390 / Natal - RN
>>Tel: (84) 3219-0427 Cel: (84) 9977-3917
>>    
>>
>
>
>
>  
>



Mime
View raw message