-->
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.  [ 5 posts ] 
Author Message
 Post subject: Problem with Accessor
PostPosted: Wed Aug 02, 2006 6:26 am 
Newbie

Joined: Mon Feb 27, 2006 2:58 am
Posts: 10
Hibernate version: 3

Problem: PropertyAccessException: IllegalArgumentException

I have Model with property called parent with accessor getParent() and also a utility method exists in the model called "isParent()".When I try to save this Model, Hibernate tries to access isParent(), not getParent()..why this is happening?parent is not a boolean type.

Question: Can somebody tell me, Is there any precedence for accessor?Will it take IsXX first then getXXX?


Top
 Profile  
 
 Post subject:
PostPosted: Wed Aug 02, 2006 11:44 pm 
Expert
Expert

Joined: Thu Dec 23, 2004 9:08 pm
Posts: 2008
According to org.hibernate.property.BasicPropertyAccessor, it tries get before is. I don't see any other code that might override that.

_________________
Code tags are your friend. Know them and use them.


Top
 Profile  
 
 Post subject: Its a Open Bug in Hibernate
PostPosted: Fri Aug 04, 2006 3:40 am 
Newbie

Joined: Mon Feb 27, 2006 2:58 am
Posts: 10
Hi tenwit,

W.r.t to the disscussion http://forum.hibernate.org/viewtopic.php?t=957800, I have found that itz still a open bug in Hibernate (http://opensource.atlassian.com/projects/hibernate/browse/HHH-1747).

I refered BasicPropertyAccessor.getterMethod()[http://www.kickjava.com/src/org/hibernate/property/BasicPropertyAccessor.java.htm].

Also API-Documentation for getDeclaredMethods() says "The elements in the array returned are not sorted and are not in any particular order", so you don't actually know which accessor will be chosen:
http://java.sun.com/j2se/1.4.2/docs/api ... edMethods()

Can you plz throw more lights on this..


Top
 Profile  
 
 Post subject:
PostPosted: Sun Aug 06, 2006 5:47 pm 
Expert
Expert

Joined: Thu Dec 23, 2004 9:08 pm
Posts: 2008
The analysis in that jira issue seems correct to me. It will indeed return the first one it finds: the fact that it checks get before is is unimportant, because it checks the methods in (undefined) order, and stops as soon as either the is- or get- versions are found.

Looks like you'll have to rename isParent until the bug is fixed. isParentModel() might work. Hibernate definitely won't find that.

_________________
Code tags are your friend. Know them and use them.


Top
 Profile  
 
 Post subject: Thanks
PostPosted: Mon Aug 07, 2006 6:16 am 
Newbie

Joined: Mon Feb 27, 2006 2:58 am
Posts: 10
Thanks for the info..
Ps: Even Xdoclet fails to generate mapping for this property in hbm.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 5 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.