-->
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: Parent child relationship
PostPosted: Fri Feb 06, 2004 2:01 pm 
Beginner
Beginner

Joined: Sun Dec 21, 2003 9:18 pm
Posts: 21
I refer to my old posting http://forum.hibernate.org/viewtopic.php?t=927600&highlight=.

I traced the error into hibernate codes. Here is my findings:

When the session is flushed, in SessionImpl.private void flushEverything()
It try to invoke my TopicAccessBean using BasicPropertyAccessor. But for some reason the BasicPropertyAccessor is making these calles:

net.sf.hibernate.property.BasicPropertyAccessor - METHOD INVOKES BY
THE GET () IS getId CLASS java.lang.Integer
37043 [tcp-connection-5] ERROR net.sf.hibernate.property.BasicPropertyAccessor - IllegalArgumentExc
eption in class: Forum.TopicBean, getter method of property: id


The debug statement above is from BasicPropertyAccessor get(Object target)

Code:
public Object get(Object target) throws HibernateException {
               try {
            
            log.debug("METHOD INVOKES BY THE GET () IS " + method.getName()  + target.getClass().getName());
            return method.invoke(target, null);
         }
         catch (InvocationTargetException ite) {
            throw new PropertyAccessException(ite, "Exception occurred inside", false, clazz, propertyName);
         }
         catch (IllegalAccessException iae) {
            throw new PropertyAccessException(iae, "IllegalAccessException occurred while calling", false, clazz, propertyName);
            //cannot occur
         }
         catch (IllegalArgumentException iae) {
            log.error(
               "IllegalArgumentException in class: " + clazz.getName() +
               ", getter method of property: " + propertyName
            );
            throw new PropertyAccessException(iae, "IllegalArgumentException occurred calling", false, clazz, propertyName);
         }
      }


Gavin here are some update that I promised you in my previous post. I am still tracing through the code. But the reflection that Hibernate uses gives a real challenge in debugging the code.

^____^


Top
 Profile  
 
 Post subject:
PostPosted: Fri Feb 06, 2004 2:04 pm 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
Looks like you have strangely messed something up.

Read through your old post again, is the calling code still the same? If yes, what are you doing in this method:

Session s = DBManager.getSession(topicBean);


Top
 Profile  
 
 Post subject:
PostPosted: Fri Feb 06, 2004 2:09 pm 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
Got it:

Code:
<many-to-one name="topicID" class="Forum.TopicBean"/>


should be

Code:
<many-to-one name="topicBean" class="Forum.TopicBean"/>


And remove all that id property crap for your relations, you don't need it. With Hibernate you don't need to store ids of related objects in a class, use a normal java reference - simple.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Feb 06, 2004 10:43 pm 
Beginner
Beginner

Joined: Sun Dec 21, 2003 9:18 pm
Posts: 21
Oooopss how can make suych stupid typo mistake I did..... Thanks for the reply.

Im still not sure what you mean by the ID's though.


Top
 Profile  
 
 Post subject:
PostPosted: Sat Feb 07, 2004 3:50 am 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
Well you should just remove the getTopicId/setTopicId methods. They are really unneccessary when you have getTopic/setTopic


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.