-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: HELP: Maven hbm2java association refers to an unmapped class
PostPosted: Mon Oct 25, 2010 4:53 pm 
Newbie

Joined: Fri May 30, 2008 9:35 am
Posts: 3
I am moving from ANT to MAVEN.

Overview:
I am working with three modules, but for this discussion lets pretend there are only two modules (core and app)
CORE has hbm.xml files located in: core/src/main/resources/hibernate/
APP has hbm.xml files located in: app/src/main/resources/hibernate/

The maven pom.xml file for CORE has the following plugin configuration:
Code:
<plugin>
    <groupId>org.codehaus.mojo</groupId>
    <artifactId>hibernate3-maven-plugin</artifactId>
    <version>2.2</version>
    <executions>
        <execution>
            <id>hbm2java</id>
            <phase>generate-sources</phase>
            <goals>
                <goal>hbm2java</goal>
            </goals>
        </execution>
        <execution>
            <id>hbm2ddl</id>
            <phase>process-classes</phase>
            <goals>
                <goal>hbm2ddl</goal>
            </goals>
        </execution>
    </executions>
    <configuration>
        <components>
            <component>
                <name>hbm2java</name>
                <implementation>configuration</implementation>
                <outputDirectory>target/generated-sources/hibernate</outputDirectory>
            </component>
            <component>
                <name>hbm2ddl</name>
                <outputDirectory>target/generated-sources/db</outputDirectory>
            </component>
        </components>
        <componentProperties>
            <drop>true</drop>
            <create>true</create>
            <export>false</export>
            <format>true</format>
            <jdk5>true</jdk5>
            <configurationfile>/src/main/resources/hibernate/hibernate.cfg.xml</configurationfile>
            <outputfilename>core-data-model.ddl.sql</outputfilename>
        </componentProperties>
    </configuration>

    <dependencies>
        <dependency>
            <groupId>com.oracle</groupId>
            <artifactId>ojdbc6</artifactId>
            <version>11.2.0.1.0</version>
        </dependency>
    </dependencies>
</plugin>


CORE generates sources perfectly. The hibernate.cfg.xml files lists the mapping for all the hml.xml files and is managed manually, it is not generated.

APP is where we are seeing a problem. APP's plugin config in the pom.xml is as follows:
Code:
<plugin>
    <groupId>org.codehaus.mojo</groupId>
    <artifactId>hibernate3-maven-plugin</artifactId>
    <version>2.2</version>
    <configuration>
        <components>
            <component>
                <name>hbm2java</name>
                <implementation>configuration</implementation>
                <outputDirectory>${project.build.directory}</outputDirectory>
            </component>
            <component>
                <name>hbm2ddl</name>
                <outputDirectory>${project.build.directory}</outputDirectory>
            </component>
        </components>
        <componentProperties>
            <drop>true</drop>
            <create>true</create>
            <export>false</export>
            <format>true</format>
            <jdk5>true</jdk5>
            <configurationfile>${basedir}/src/main/resources/hibernate/hibernate.cfg.xml</configurationfile>
            <outputfilename>ccfs-data-model.ddl.sql</outputfilename>
        </componentProperties>
    </configuration>
    <executions>
        <execution>
            <id>hbm2java</id>
            <phase>generate-sources</phase>
            <goals>
                <goal>hbm2java</goal>
            </goals>
        </execution>
        <execution>
            <id>hbm2ddl</id>
            <phase>process-classes</phase>
            <goals>
                <goal>hbm2ddl</goal>
            </goals>
        </execution>
    </executions>

    <dependencies>
        <dependency>
            <groupId>com.oracle</groupId>
            <artifactId>ojdbc6</artifactId>
            <version>11.2.0.1.0</version>
        </dependency>
        <dependency>
            <groupId>com.gxs.core</groupId>
            <artifactId>core</artifactId>
            <version>1.0</version>
        </dependency>
    </dependencies>
</plugin>


I have run mvn clean install on CORE and have verified that the CORE jar file is in my local repository.

When i run mvn clean generate-sources on APP, i am getting the following error:
Code:
An association from the table APP_CIS_REGION refers to an unmapped class: com.itp.gt.data.org.generated.CfgUser


the AppCisRegion.hbm.xml file has a many to one relationship to CfgUser and its not able to find the CORE generated class CfgUser.java. Looking in the CORE JAR, this class exists in that specified path. What am I doing wrong here. Any help is appreciated. Thanks.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.