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.  [ 2 posts ] 
Author Message
 Post subject: Can't access generated java class from hbm2java
PostPosted: Fri Apr 01, 2011 8:55 pm 
Newbie

Joined: Mon Feb 01, 2010 4:19 am
Posts: 11
I configured my pom.xml so that it will use the hbm2java to generate a class source file from

./src/main/resources/com/brie/domain/Meeting.hbm.xml.

Problem is, the generated file goes into the

./target/hibernate3/generated-sources/com/brie/domain/Meeting.java

directory and I can't seem to access it from my program using it unless I manually copy it over into

src/main/java/com/brie/domain.

What is a good way to go about this?

Below is my pom.xml file

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.hibernate.tutorials</groupId>
<packaging>war</packaging>
<artifactId>hibernate-tutorial</artifactId>
<version>1.0.0-SNAPSHOT</version>
<name>First Hibernate Tutorial</name>
<build>
<!-- we dont want the version to be part of the generated war file name -->
<finalName>${artifactId}</finalName>
<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>2.2</version>
<configuration><components>
<component>
<name>hbm2java</name>
<implementation>configuration</implementation>
</component>

</components>
<componentProperties>
<drop>false</drop>
<jdk5>true</jdk5>
</componentProperties>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
<version>3.6.2.Final</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>javassist</groupId>
<artifactId>javassist</artifactId>
<version>3.12.1.GA</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
<version>1.6.1</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>hsqldb</groupId>
<artifactId>hsqldb</artifactId>
<version>1.8.0.10</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
</dependencies>
</project>


Top
 Profile  
 
 Post subject: Re: Can't access generated java class from hbm2java
PostPosted: Fri Apr 01, 2011 9:26 pm 
Newbie

Joined: Mon Feb 01, 2010 4:19 am
Posts: 11
I added the outputDirectory to my pom.xml and the generated class goes into my source directory. I am not sure this is the most robust solution though, as this is the same area I am manually creating classes. Other suggestions?

brian

Code:
   <plugin>
      <groupId>org.codehaus.mojo</groupId>
      <artifactId>hibernate3-maven-plugin</artifactId>
      <version>2.2</version>
      <configuration>
         <components>
            <component>
               <name>hbm2java</name>
               <outputDirectory>src/main/java</outputDirectory>
                <implementation>configuration</implementation>
            </component>
         </components>

         <componentProperties>
              <drop>false</drop>
            <jdk5>true</jdk5>
          </componentProperties>
      </configuration>
   </plugin>


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

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.