-->
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: using entity-name and join - is it possible?
PostPosted: Thu Mar 30, 2006 7:20 am 
Newbie

Joined: Thu Feb 12, 2004 11:52 am
Posts: 6
We have defined multiple mapping files using the same class for loading from multiple tables.

To do this with specify a different entity-name for each mapping we do.

the problem seems to be that when using a <join> to load an attribute of our object from another table, the HbmBinder class use the entityName to bind the property to the class instance and return a MappingException that says:

org.hibernate.MappingException: class entityName not found while looking for property: propertyName

Looking in HbmBinder code at line 957 I've seen the following:
Code:
if ( value != null ) {
            Property prop = createProperty( value, propertyName, persistentClass
               .getEntityName(), subnode, mappings, inheritedMetas );
            prop.setOptional( join.isOptional() );
            join.addProperty( prop );
         }


shouldn't it be:
Code:
if ( value != null ) {
            Property prop = createProperty( value, propertyName, persistentClass
               .getClassName(), subnode, mappings, inheritedMetas );
            prop.setOptional( join.isOptional() );
            join.addProperty( prop );
         }


I changed from persistentClass.getEntityName() to persistentClass.getClassName()

becuase the createProperty method is using value.setTypeUsingReflection( className, propertyName ); and here we need the name of the class....

what do you think?

am I completely wrong?

I also found another post that is caused by the same error (I think). here is the link:
http://forum.hibernate.org/viewtopic.php?t=941379

I've tested this with Hibernate 3.1, 3.1.2 and 3.1.3... always the same MappingException

If I don't write the entityName in the mapping file everything works perfectly.

I hope somebody can give me some help or suggest a workaround for using entityNames and <join> together.

thanks in advance!
[/i]


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.