-->
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: Hibernate not recognising fully qualified class name ?
PostPosted: Tue Oct 10, 2006 12:11 pm 
Newbie

Joined: Tue Oct 10, 2006 11:59 am
Posts: 2
Hi,

I have notice a problem where I have lets say a class

x.y.MyDataClass

and another classs lets call in

a.b.c.MyDataClass


both of these classes are mapped to a database table in hibernate config file.

Both of these work okay seperately.
But when they are used in same project they conflict even though the classes are fully qualified in the mapping file.

Renaming one of thes eg x.y.MyDataClass becomes x.y.YourDataClass

and it all works okay again.

Has anyone else seen this problem?

It looks like a hibernate bug to me.
I am in the process of testing this outside my application to check this.

Any ideas?
B


Top
 Profile  
 
 Post subject:
PostPosted: Wed Oct 11, 2006 5:39 am 
Newbie

Joined: Tue Oct 10, 2006 11:59 am
Posts: 2
Solved it.
You need to set the autoImport=false in the hibernate mapping file

From the manual.
----
If you have two persistent classes with the same (unqualified) name, you should set auto-import="false". Hibernate will throw an exception if you attempt to assign two classes to the same "imported" name.
----

So
<hibernate-mapping auto-import="false">
<class name="x.y.MyData" table="MY_DATA_TABLE">


Hope this saves someone else some time.

B


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.