Nathan Anderson wrote:
I can't help answer all of your questions, but I'll take a stab at a
couple of them...
upstreamnet wrote:
Hi, I've been looking at the pom.xml that is generated for the JSF Basic
archetype. I was curious to figure out what causes the db schema
generated by hbm2ddl
to be applied before dbUnit plug in runs and populates the database.
That's one that I don't know....
If you look at your pom.xml you will find
<executions>
<execution>
<phase>process-test-resources</phase>
<goals>
<goal>hbm2ddl</goal>
</goals>
</execution>
</executions>
In the hibernate3-maven-plugin it says that hbm2dll should be run in the
process test rexources phase of the build lifecycle
(more here
http://maven.apache.org/guides/introduction/introduction-to-the-lifecycle.html)
for db unit it is
<executions>
<execution>
<phase>test-compile</phase>
<goals>
<goal>clean-insert</goal>
</goals>
</execution>
</executions>
ie the text-compile phase.
In the build lifecycle the test-compile comes before process-test-resources
I noticed that the schema-export and schema-update goals were not
specified
in the configuration of the hibernate3-maven-plugin.... But there
is a
createDatabaseIfNotExist=true parameter specified on the jdbc.url in
pom.xml.. So I thought that might have something to do with it...
I think that just creates the DB not the entire DDL.
But then I was stumped as to where the DDL that defines the schema was
actually picked up... I grep'd for 'create table' starting from the
project
root.. but could not find any file that contained such of evidence of
a DDL
statements.
You didn't find the DDL stuff because it isn't there ;) [I know, big
help so far, right?]. Hibernate creates the DDL based on the
annotations in the Pojo's. Actually Hibernate creates .hbm.xml files
and then it creates the DDL based on those. The goal that triggers
the creation of the schema is:
mvn hibernate3:hbm2ddl
Not a life-and-death question... but I was very curious to understand
how
this works... Thanks in advance to anyone who could help explain...
- chris
Hope that Helps,
Nathan
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]