Details
-
Type:
Improvement
-
Status:
Open
-
Priority:
Major
-
Resolution: Unresolved
-
Affects Version/s: 2.2
-
Fix Version/s: 3.1
-
Component/s: jpaconfiguration
-
Labels:None
-
Number of attachments :
Description
The hibernate3-maven-plugin works very well in the main project where JPA annotations are used, like this:
<plugin>
<!-- outputs to target/hibernate3/sql/schema.ddl -->
<groupId>org.codehaus.mojo</groupId>
<artifactId>hibernate3-maven-plugin</artifactId>
<version>2.2</version>
<executions>
<execution>
<phase>process-test-resources</phase>
<goals>
<goal>hbm2ddl</goal>
</goals>
</execution>
</executions>
<configuration>
<components>
<component>
<name>hbm2ddl</name>
<implementation>jpaconfiguration</implementation>
</component>
</components>
<componentProperties>
<jdk5>true</jdk5>
<propertyfile>src/main/resources/datasource.properties</propertyfile>
<!-- set this to whatever was set in persistence.xml -->
<persistenceunit>mailPersistence</persistenceunit>
<outputfilename>schema.ddl</outputfilename>
<drop>false</drop>
<create>true</create>
<export>false</export>
<format>true</format>
</componentProperties>
</configuration>
</plugin>
However, I have an "overlay" war build that depends on the former war build, like this:
<build>
<finalName>mailportlet</finalName>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.0</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>exploded</goal>
</goals>
<configuration>
<webappDirectory>target</webappDirectory>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<!-- outputs to target/hibernate3/sql/schema.ddl -->
<groupId>org.codehaus.mojo</groupId>
<artifactId>hibernate3-maven-plugin</artifactId>
<version>2.2</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>hbm2ddl</goal>
</goals>
</execution>
</executions>
<configuration>
<components>
<component>
<name>hbm2ddl</name>
<implementation>jpaconfiguration</implementation>
</component>
</components>
<componentProperties>
<jdk5>true</jdk5>
<propertyfile>src/main/resources/datasource.properties</propertyfile>
<!-- set this to whatever was set in persistence.xml -->
<persistenceunit>mailPersistence</persistenceunit>
<outputfilename>schema.ddl</outputfilename>
<drop>false</drop>
<create>true</create>
<export>false</export>
<format>true</format>
</componentProperties>
</configuration>
</plugin>
</plugins>
</build>
Basically what I'm trying to do is to overlay the war (part of which modifies the hibernate.dialect), then explode it so that the Maven 2.x Hibernate Plugin could in-theory access the JPA configuration and the JPA annotated model classes. However, this doesn't work.
Any ideas about how I could accomplish this? It would be great to have an example of this type of usage in the documentation as well, if it is possible, and if it isn't possible, it would be a great enhancement to somehow allow this type of use.
Thanks in advance for any help,
Gary
If you are curious, here is the difference in output:
[INFO] [hibernate3:hbm2ddl {execution: default}] 17:04:15,417 INFO org.hibernate.cfg.annotations.Version - Hibernate Annotations 3.4.0.GA 17:04:15,424 INFO org.hibernate.cfg.Environment - Hibernate 3.3.1.GA 17:04:15,427 INFO org.hibernate.cfg.Environment - hibernate.properties not found 17:04:15,429 INFO org.hibernate.cfg.Environment - Bytecode provider name : javassist 17:04:15,431 INFO org.hibernate.cfg.Environment - using JDK 1.4 java.sql.Timestamp handling 17:04:15,466 INFO org.hibernate.annotations.common.Version - Hibernate Commons Annotations 3.1.0.GA 17:04:15,468 INFO org.hibernate.ejb.Version - Hibernate EntityManager 3.4.0.GA 17:04:15,963 INFO org.hibernate.cfg.AnnotationBinder - Binding entity from annotated class: org.jasig.portlet.mail.model.impl.MailAccountImpl 17:04:15,985 INFO org.hibernate.cfg.annotations.EntityBinder - Bind entity org.jasig.portlet.mail.model.impl.MailAccountImpl on table MAIL_ACCOUNT 17:04:16,037 INFO org.hibernate.cfg.AnnotationBinder - Binding entity from annotated class: org.jasig.portlet.mail.model.impl.MailAccountSetImpl 17:04:16,037 INFO org.hibernate.cfg.annotations.EntityBinder - Bind entity org.jasig.portlet.mail.model.impl.MailAccountSetImpl on table MAIL_ACCOUNT_SET 17:04:16,056 INFO org.hibernate.cfg.AnnotationBinder - Binding entity from annotated class: org.jasig.portlet.mail.model.impl.MailCredentialsImpl 17:04:16,057 INFO org.hibernate.cfg.annotations.EntityBinder - Bind entity org.jasig.portlet.mail.model.impl.MailCredentialsImpl on table MAIL_ACCOUNT_CREDENTIAL 17:04:16,095 INFO org.hibernate.cfg.annotations.CollectionBinder - Mapping collection: org.jasig.portlet.mail.model.impl.MailAccountSetImpl.accounts -> MAIL_ACCOUNT 17:04:16,098 INFO org.hibernate.cfg.AnnotationConfiguration - Hibernate Validator not found: ignoring [INFO] No hibernate configuration file loaded. [INFO] Configuration Properties file loaded: .../src/main/resources/datasource.properties 17:04:16,117 INFO org.hibernate.dialect.Dialect - Using dialect: org.hibernate.dialect.HSQLDialect 17:04:16,138 INFO org.hibernate.tool.hbm2ddl.SchemaExport - Running hbm2ddl schema export 17:04:16,138 INFO org.hibernate.tool.hbm2ddl.SchemaExport - writing generated schema to file: .../target/hibernate3/sql/schema.ddl ... 17:04:16,139 INFO org.hibernate.tool.hbm2ddl.SchemaExport - schema export complete