-->
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: xdoclet / hibernate foreign key generator param issue
PostPosted: Tue Mar 14, 2006 12:28 am 
Newbie

Joined: Tue Mar 14, 2006 12:12 am
Posts: 1
I have not had a chance to look into whether or not the issue is with Xdoclet (I am using a 1.3 snapshot), but I think the problem may also reside in Hibernate itself. Using XDoclet to generate the Hibernate mapping files and for a one-to-one mapping in the child class, the resulting relavent hbm file is as follows:


<generator
class="foreign"
>
<param name="property">
<![CDATA[user]]>
</param>

</generator>

When I attempt to save the parent object and the save cascades to the child object with the above contained mapping file, the resulting error is along the lines of:

Unable to resolve property: <white space>user<whitespace>

This is triggered in the call to getPropertyIndex within tuple/EntityMetamodel.java.

Specifically looking into the propertyName being requested, it is indeed the string "user" pre- and post-pended with whitespace. The whitespace should really be trimmed.

I found one of two fixes to this. First, hand editting the hbm file generated by xdoclet to read:

<generator
class="foreign"
>
<param name="property">user</param>

</generator>

Or, edit the Hibernate source, specifically around line 1964 of cfg/HbmBinder.jave from:


Iterator iter = subnode.elementIterator( "param" );
while ( iter.hasNext() ) {
Element childNode = (Element) iter.next();
params.setProperty( childNode.attributeValue( "name" ), childNode.getText() );
}

TO:

Iterator iter = subnode.elementIterator( "param" );
while ( iter.hasNext() ) {
Element childNode = (Element) iter.next();
params.setProperty( childNode.attributeValue( "name" ), childNode.getTextTrim() );
}

In otherwords, calling getTextTrim() on the childNode. getTextTrim is used in a number of other instances. Is this the proper fix? Or is there something else that also needs to be addressed with Xdoclet?

Thanks
-jim spring


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:
cron
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.