I am using the hibernate3 plugin for maven2. When I attempt to generate my
POJO's from my hbm files I get the following error.
[INFO] Preparing hibernate3:hbm2java
[WARNING] Removing: hbm2java from forked lifecycle, to prevent recursive
invocation.
[INFO] No goals needed for project - skipping
[INFO] [hibernate3:hbm2java {execution: hbm2java}]
Aug 19, 2006 2:30:59 PM org.hibernate.cfg.Environment <clinit>
INFO: Hibernate 3.2 cr2
Aug 19, 2006 2:30:59 PM org.hibernate.cfg.Environment <clinit>
INFO: hibernate.properties not found
Aug 19, 2006 2:30:59 PM org.hibernate.cfg.Environment buildBytecodeProvider
INFO: Bytecode provider name : cglib
Aug 19, 2006 2:30:59 PM org.hibernate.cfg.Environment <clinit>
INFO: using JDK 1.4 java.sql.Timestamp handling
Aug 19, 2006 2:30:59 PM org.hibernate.cfg.Configuration configure
INFO: configuring from file: hibernate.cfg.xml
Aug 19, 2006 2:30:59 PM org.hibernate.cfg.Configuration addResource
INFO: Reading mappings from resource: CategoryImpl.hbm.xml
[INFO]
------------------------------------------------------------------------
[ERROR] FATAL ERROR
[INFO]
------------------------------------------------------------------------
[INFO] Resource: CategoryImpl.hbm.xml not found
[INFO]
------------------------------------------------------------------------
[INFO] Trace
org.hibernate.MappingException: Resource: CategoryImpl.hbm.xml not found
at
org.hibernate.cfg.Configuration.addResource(Configuration.java:512)
at
org.hibernate.cfg.AnnotationConfiguration.parseMappingElement(AnnotationConf
iguration.java:348)
at
org.hibernate.cfg.Configuration.parseSessionFactory(Configuration.java:1474)
at
org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1453)
at
org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1427)
.
.
.
My configuration is as follows.
Hibernate.cfg.xml
<?xml version='1.0' encoding='utf-8'?>
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
<!-- a SessionFactory instance -->
<session-factory name="hibernate_session">
<!-- begin: properties -->
<property
name="connection.driver_class">com.mysql.jdbc.Driver</property>
<property
name="connection.url">jdbc:mysql://localhost:3306/wcs</property>
<property name="connection.username">root</property>
<property name="connection.password">xxxxxxx</property>
<property name="dialect">org.hibernate.dialect.MySQLDialect</property>
<property name="show_sql">false</property>
<!-- end: properties -->
<mapping resource="CategoryImpl.hbm.xml"/>
<mapping resource="src/main/domain/AddressFormatImpl.hbm.xml"/>
<mapping resource="src/main/domain/AddressImpl.hbm.xml"/>
</session-factory>
</hibernate-configuration>
Pom.xml excerpt
<build>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
</resource>
<resource>
<directory>src/main/domain</directory>
<filtering>true</filtering>
</resource>
</resources>
<extensions>
<extension>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.0.2</version>
</extension>
</extensions>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.5</source>
<target>1.5</target>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>hibernate3-maven-plugin</artifactId>
<version>1.0-SNAPSHOT</version>
<executions>
<execution>
<id>hbm2java</id>
<phase>generate-sources</phase>
<goals>
<goal>hbm2java</goal>
</goals>
<configuration>
<hibernate>
<configurationFile>src/main/resources/hibernate.cfg.xml</configurationFile>
</hibernate>
<outputDirectory>
<hbm2java>src/main/java</hbm2java>
</outputDirectory>
</configuration>
</execution>
I am using hibernate-tools-3.2.0.beta6a with hibernate-3.2.0rc2. I have
also tried hibernate-tools-3.1.0beta4 with hibernate-3.1.2 with the same
problem. Futhermore, I have attempted to change the path to the hbm files,
to no avail. This should be an easy thing to do, but every combination I
try fails with the same error. Any assistance would be welcomed.
thanks