Question

How do you make Cargo maven plugin create tables on an embedded database using the Glassfish container. without modifying the original EAR?

If it was using asadmin, the --createtables=true can be added to create the tables on deployment.

At the moment I am creating the database as follows:

<cargo.datasource.datasource.derby>
cargo.datasource.driver=org.apache.derby.jdbc.EmbeddedDriver|
cargo.datasource.url=jdbc:derby:derbyDB;create=true|
cargo.datasource.jndi=jdbc/__default|
cargo.datasource.username=APP|
cargo.datasource.password=nonemptypassword
</cargo.datasource.datasource.derby>

The database is created successfully, but there are no tables (as expected) in it yet. I need to tell the persistence provider to create the tables.

Was it helpful?

Solution

From looking at the doDeploy it does not appear to allow passing additional parameters.

I have actually fixed it on the CARGO source code. https://jira.codehaus.org/browse/CARGO-1245

So when the fix gets released, the following can be done to create the tables and drop them.

<cargo.glassfish.deploy.arg.1>--createtables=true</cargo.glassfish.deploy.arg.1>
<cargo.glassfish.undeploy.arg.1>--droptables=true</cargo.glassfish.undeploy.arg.1>
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top