-->
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: hbm2java, package names -> generated import statements
PostPosted: Wed Sep 08, 2004 9:28 am 
Newbie

Joined: Wed Sep 08, 2004 9:19 am
Posts: 4
Hibernate version:

2.1.6
2.1.2 extensions

Mapping documents:

1) file:

<hibernate-mapping package="test">
<class name="ClassA" table="CLASS_A" lazy="true">

<id name="id" type="long" column="CLASS_A_ID" >
<generator class="native"/>
</id>

<many-to-one name="myClassB" class="ClassB"/>

</class>
</hibernate-mapping>

2) file:

<hibernate-mapping package="test">
<class name="ClassB" table="CLASS_B" lazy="true">

<id name="id" type="long" column="CLASS_B_ID">
<generator class="native"/>
</id>

</class>
</hibernate-mapping>



After running hbm2java (as ant task) on the given mapping files the ClassA.java file contains an import statement for ClassB without the proper package name "test."

Since both classes are members of package "test" as defined in the mappings, there should be no import statement OR a correct import statement containing the fully qualified name "test.ClassB"

Generated file for ClassA:

package test;

import ClassB; <-- BAD !!!
import java.io.Serializable;
import org.apache.commons.lang.builder.ToStringBuilder;


/** @author Hibernate CodeGenerator */
public class ClassA implements Serializable {

...

}


Where is my mistake or is this a bug in the CodeGenerator?

TIA


Top
 Profile  
 
 Post subject:
PostPosted: Wed Sep 08, 2004 11:01 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
The package="xxx" construct is fairly new, so the released hbm2java doesn't support it yet. Please use the cvs version or use fully qualiifed names in the class name.

_________________
Max
Don't forget to rate


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.