I have an enterprise application that uses a single database, but the application needs to support mysql, oracle, and sql*server as installation options.
To try to remain portable we are using JPA annotations with Hibernate as the implementation. We also have a test-bed instance of each database running for development.
The app is building nicely in Maven and I've played around with the hibernate3-maven-plugin and can auto-generate DDL for a given database dialect.
What is the best way to approach this so that individual developers can easily test against all three databases and our Hudson based CI server can build things properly.
More specifically:
I thought the hbm2ddl goal in the hibernate3-maven-plugin would just generate a schema file, but apparently it connects to a live database and attempts to create the schema. Is there a way to have this just create the schema file for each database dialect without connecting to a database?
If the hibernate3-maven-plugin insists on actually creating the database schema, is there a way to have it drop the database and recreate it before creating the schema?
I am thinking that each developer (and the Hudson build machine) should have their own separate database on each database server. Is this typical?
Will developers have to run Maven three times... once for each database vendor? If so, how do I merge the results on the build machine?
There is a hbm2doc goal within hibernate3-maven-plugin. It seems overkill to run this three times... I gotta believe it'd be nearly identical for each database.
Set
export
tofalse
. Something like this:See above. But just in case, for this set
update
totrue
:Yes, and I consider this as a best practices (see Use one database instance per developer).
Yes, very likely and I would use profiles for each database. On the build machine, I would build a matrix project.
I'm not used to this tool but I guess there might be some little variation in the output (e.g. with the primary key generation). I would generate the schema documentation for each database but at release time only (there is certainly no need to run that at each build).