hbm2java failed:Unable to load class declared as <mapping class="com.dss.domain.Foo"/>
All,

I am implementing generation of the domain/model POJOs from database using the Hibernate3 Maven Plugin. The rationale is to ensure a DBA's updates to the database are automatically mapped to the model layer before a developer starts working on further things. So the way it has to work is that a Hibernate CFG is generated and then POJOs; also since the older implementation consisted of developers using annotations instead of hbm.xml the generated classes are required to be annotated. Here's extract from the POM for Hibernate Maven Plugin

    <build>
    <plugins>
      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>hibernate3-maven-plugin</artifactId>
        <version>2.2</version>
        <executions>
          <execution>
            <id>hbm2cfgxml</id>
            <phase>generate-resources</phase>
            <goals>
              <goal>hbm2cfgxml</goal>
            </goals>
            <inherited>false</inherited>
            <configuration>
              <components>
                <component>
                  <name>hbm2cfgxml</name>
                  <implementation>jdbcconfiguration</implementation>
                </component>
              </components>
              <componentProperties>
                <ejb3>true</ejb3>
                <packagename>com.dss.domain</packagename>
              </componentProperties>
            </configuration>
          </execution>
          <execution>
            <id>hbm2java</id>
            <phase>generate-sources</phase>
            <goals>
              <goal>hbm2java</goal>
            </goals>
            <inherited>false</inherited>
            <configuration>
              <components>
                <component>
                  <name>hbm2java</name>
                  <implementation>annotationconfiguration</implementation>
                </component>
              </components>
              <componentProperties>
                <ejb3>true</ejb3>
                <packagename>com.dss.domain</packagename>
                <configurationfile>target/hibernate3/generated-mappings/hibernate.cfg.xml</configurationfile>
              </componentProperties>
            </configuration>
          </execution>
        </executions>
        <dependencies>
          <dependency>
            <groupId>mysql</groupId>
            <artifactId>mysql-connector-java</artifactId>
            <version>5.1.16</version>
          </dependency>
        </dependencies>
      </plugin>
    </plugins>
   </build>

I can see the cfg.xml file is generated; but hbm2java fails with message

> Failed to execute goal
> org.codehaus.mojo:hibernate3-maven-plugin:2.2:hbm2java (hbm2java) on
> project dss-domain: Execution hbm2java of goal
> org.codehaus.mojo:hibernate3-maven-plugin:2.2:hbm2java failed: Unable
> to load class declared as < mapping
> class="com.dss.domain.Foo" / > in the configuration: -> [Help
> 1]

At a later stage all of this has to be moved the JPA implementation that we currently have, so the other question is do I then have to switch to jpaconfiguration in component properties?

Also none of these seems to work at all if I update the dependencies to the ones recently uopdated in the older project (Hibernate 3.6.6-FINAL); but that's a separate question posted here.

Any pointers or complete solutions are very welcome ;-)
hbm2java failed:Unable to load class declared as <mapping class="com.dss.domain.Foo"/>
===

All,

I am implementing generation of the domain/model POJOs from database using the Hibernate3 Maven Plugin. The rationale is to ensure a DBA's updates to the database are automatically mapped to the model layer before a developer starts working on further things. So the way it has to work is that a Hibernate CFG is generated and then POJOs; also since the older implementation consisted of developers using annotations instead of hbm.xml the generated classes are required to be annotated. Here's extract from the POM for Hibernate Maven Plugin

    <build>
    <plugins>
      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>hibernate3-maven-plugin</artifactId>
        <version>2.2</version>
        <executions>
          <execution>
            <id>hbm2cfgxml</id>
            <phase>generate-resources</phase>
            <goals>
              <goal>hbm2cfgxml</goal>
            </goals>
            <inherited>false</inherited>
            <configuration>
              <components>
                <component>
                  <name>hbm2cfgxml</name>
                  <implementation>jdbcconfiguration</implementation>
                </component>
              </components>
              <componentProperties>
                <ejb3>true</ejb3>
                <packagename>com.dss.domain</packagename>
              </componentProperties>
            </configuration>
          </execution>
          <execution>
            <id>hbm2java</id>
            <phase>generate-sources</phase>
            <goals>
              <goal>hbm2java</goal>
            </goals>
            <inherited>false</inherited>
            <configuration>
              <components>
                <component>
                  <name>hbm2java</name>
                  <implementation>annotationconfiguration</implementation>
                </component>
              </components>
              <componentProperties>
                <ejb3>true</ejb3>
                <packagename>com.dss.domain</packagename>
                <configurationfile>target/hibernate3/generated-mappings/hibernate.cfg.xml</configurationfile>
              </componentProperties>
            </configuration>
          </execution>
        </executions>
        <dependencies>
          <dependency>
            <groupId>mysql</groupId>
            <artifactId>mysql-connector-java</artifactId>
            <version>5.1.16</version>
          </dependency>
        </dependencies>
      </plugin>
    </plugins>
   </build>

I can see the cfg.xml file is generated; but hbm2java fails with message

> Failed to execute goal
> org.codehaus.mojo:hibernate3-maven-plugin:2.2:hbm2java (hbm2java) on
> project dss-domain: Execution hbm2java of goal
> org.codehaus.mojo:hibernate3-maven-plugin:2.2:hbm2java failed: Unable
> to load class declared as < mapping
> class="com.dss.domain.Foo" / > in the configuration: -> [Help
> 1]

At a later stage all of this has to be moved the JPA implementation that we currently have, so the other question is do I then have to switch to jpaconfiguration in component properties?

Also none of these seems to work at all if I update the dependencies to the ones recently uopdated in the older project (Hibernate 3.6.6-FINAL); but that's a separate question posted here.

Any pointers or complete solutions are very welcome ;-)