-->
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.  [ 3 posts ] 
Author Message
 Post subject: proxy object(enhanced by CGLIB) and apache PropertyUtils
PostPosted: Thu Mar 03, 2005 7:05 am 
Newbie

Joined: Sat Oct 30, 2004 4:00 am
Posts: 11
Read the rules before posting!
http://www.hibernate.org/ForumMailingli ... AskForHelp

Hibernate version: 2.1.8

Mapping documents:
<class name="Foo" lazy="true">
...
</class>

Code between sessionFactory.openSession() and session.close():
foo=session.get(id);
assertTrue(foo instanceof HibernateProxy);//foo is a proxy
newFoo=org.apache.commons.beanutils.BeanUtils.cloneBean(foo);//error!

Full stack trace of any exception that occurs:
java.lang.NoSuchMethodException: Property 'callback' has no getter method
at org.apache.commons.beanutils.PropertyUtils.getSimpleProperty(PropertyUtils.java:1180)
at org.apache.commons.beanutils.PropertyUtils.copyProperties(PropertyUtils.java:318)
at org.apache.commons.beanutils.BeanUtils.cloneBean(BeanUtils.java:167)


Name and version of the database you are using:
oracle9i

The generated SQL (show_sql=true):
none

Debug level Hibernate log excerpt:
none

Exception occures when cloning a lazy-load-persistent object by BeanUtils.
I think this error comes from CGLib or BeanUtils, not Hibernate,
but developer always use BeanUtils and Hibernate together.
Any suggestion?

Giang


Top
 Profile  
 
 Post subject:
PostPosted: Thu Mar 03, 2005 8:01 am 
CGLIB Developer
CGLIB Developer

Joined: Thu Aug 28, 2003 1:44 pm
Posts: 1217
Location: Vilnius, Lithuania
You can "unproxy" bean before to clone, there is API for this stuff.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Mar 03, 2005 10:15 pm 
Newbie

Joined: Sat Oct 30, 2004 4:00 am
Posts: 11
baliukas wrote:
You can "unproxy" bean before to clone, there is API for this stuff.


Thanks.
Unproxy is the only way.
But it means that proxy(when session is still opening) is an invalid bean!


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