Maven 1.x Hibernate Plugin

maven-hibernate ignores the "config" attribute

Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Resolution: Fixed
  • Affects Version/s: None
  • Fix Version/s: 1.2
  • Component/s: None
  • Labels:
    None
  • Number of attachments :
    1

Description

Hibernate allows you to use an xml config file instead of the
regular properties file. Everything is almost in place, however
I needed the attached patch to make it actually work.

The patch to plugin.jelly brings the property to the tag and
the Java code patch allows Hibernate to open the correct file.

Please apply

Activity

Hide
David Eric Pugh added a comment -

Henning,

I've applied your patch, however, the unit test I wrote to verify it continues to fail. I had tried to do what you did before, but gave up. Could you look at the checked in test "test-hibernate-schema-export-configuration" and let me know what I'm doing wrong... As far as I can tell, it should work, but I'm getting some classpath issues.

I tweaked SchemaExportBean so that if you are using a config file the classpath loader magic is skipped.. Look at the changes in the execute method.

Eric

Show
David Eric Pugh added a comment - Henning, I've applied your patch, however, the unit test I wrote to verify it continues to fail. I had tried to do what you did before, but gave up. Could you look at the checked in test "test-hibernate-schema-export-configuration" and let me know what I'm doing wrong... As far as I can tell, it should work, but I'm getting some classpath issues. I tweaked SchemaExportBean so that if you are using a config file the classpath loader magic is skipped.. Look at the changes in the execute method. Eric
Hide
David Eric Pugh added a comment -

I've since figured out the classpath issues, and the basic unit test works.. However, when I tried to use it on a large project, I am getting lots of duplicate import errors:

Could not configure datastore from file: C:\clients\anite\cvs\ctms\target\classes\com\anite\ctms\zebra\om\HibernateProcessInstance.hbm.xml
net.sf.hibernate.MappingException: duplicate import: HibernateProcessInstance
at net.sf.hibernate.cfg.Mappings.addImport(Mappings.java:85)
at net.sf.hibernate.cfg.Binder.bindClass(Binder.java:126)
at net.sf.hibernate.cfg.Binder.bindRootClass(Binder.java:221)
at net.sf.hibernate.cfg.Binder.bindRoot(Binder.java:1243)
at net.sf.hibernate.cfg.Configuration.add(Configuration.java:249)
at net.sf.hibernate.cfg.Configuration.addFile(Configuration.java:171)
at org.apache.maven.hibernate.beans.SchemaExportBean.getConfiguration(SchemaExportBean.java:257)

So, I'm leaving this issue open for now.. Let me know how it works for you.

Show
David Eric Pugh added a comment - I've since figured out the classpath issues, and the basic unit test works.. However, when I tried to use it on a large project, I am getting lots of duplicate import errors: Could not configure datastore from file: C:\clients\anite\cvs\ctms\target\classes\com\anite\ctms\zebra\om\HibernateProcessInstance.hbm.xml net.sf.hibernate.MappingException: duplicate import: HibernateProcessInstance at net.sf.hibernate.cfg.Mappings.addImport(Mappings.java:85) at net.sf.hibernate.cfg.Binder.bindClass(Binder.java:126) at net.sf.hibernate.cfg.Binder.bindRootClass(Binder.java:221) at net.sf.hibernate.cfg.Binder.bindRoot(Binder.java:1243) at net.sf.hibernate.cfg.Configuration.add(Configuration.java:249) at net.sf.hibernate.cfg.Configuration.addFile(Configuration.java:171) at org.apache.maven.hibernate.beans.SchemaExportBean.getConfiguration(SchemaExportBean.java:257) So, I'm leaving this issue open for now.. Let me know how it works for you.
Hide
Henning Schmiedehausen added a comment -

You should load either the XML file or the properties file. Loading
both will result in "duplicate imports".

I use this patch for a large(ish) project and it works fine.

Regards
Henning

Show
Henning Schmiedehausen added a comment - You should load either the XML file or the properties file. Loading both will result in "duplicate imports". I use this patch for a large(ish) project and it works fine. Regards Henning
Hide
David Eric Pugh added a comment -

Okay, I believe you. I can't get it to work with my large project, but it clearly works in the unit test.. I tweaked around, and I'm sure I not setting properties. I will test on another project.

Show
David Eric Pugh added a comment - Okay, I believe you. I can't get it to work with my large project, but it clearly works in the unit test.. I tweaked around, and I'm sure I not setting properties. I will test on another project.

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated:
    Resolved: