metacubed
metacubed

Reputation: 7271

Include schema generation in openjpa:sql task

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?

Upvotes: 1

Views: 80

Answers (0)

Related Questions