Include schema generation in openjpa:sql task

93 Views Asked by At

I'm using the openjpa-maven-plugin to generate DDL files from my OpenJPA persistence entities. For example:

@Entity
@Table(schema = "myschema", name = "mytable")
public class MyEntity {
    ....
}

The openjpa:sql task generates the following DDL:

CREATE TABLE myschema.mytable (...);

If I run this DDL on a new DB, it would complain about the missing myschema schema. So the ideal DDL output would be:

CREATE SCHEMA IF NOT EXISTS myschema;
CREATE TABLE myschema.mytable (...);

Is there a way to tell the Maven plugin to also add in that extra SQL statement to create the schema?

0

There are 0 best solutions below