-->
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.  [ 8 posts ] 
Author Message
 Post subject: collection empty/null returns error
PostPosted: Thu Mar 24, 2005 8:43 pm 
Beginner
Beginner

Joined: Tue Jan 18, 2005 6:44 pm
Posts: 39
Hi,
I have the following mapping in my hbm

<set name="formpage" inverse="true" outer-join="true" cascade="all-delete-orphan">
<key column="FORM_ID"/>
<one-to-many class="FormPage"/>
</set>

It is possible that the collection is empty or null if the formpage table is not populated and that shouldnt stop me from retrieving an instance of the parent object containing this collection. But I still get the error

org.hibernate.PropertyAccessException: exception getting property value with CGLIB (set hibernate.cglib.use_reflection_optimizer=false for more info) getter of com.siVault.siForms.BusinessObjects.FormPage.?
at org.hibernate.tuple.PojoComponentTuplizer.getPropertyValues(PojoComponentTuplizer.java:42)
at org.hibernate.type.ComponentType.getPropertyValues(ComponentType.java:257)
at org.hibernate.type.ComponentType.getHashCode(ComponentType.java:158)
at org.hibernate.engine.EntityKey.getHashCode(EntityKey.java:68)
at org.hibernate.engine.EntityKey.<init>(EntityKey.java:41)
at org.hibernate.loader.Loader.registerNonExists(Loader.java:512)
at org.hibernate.loader.Loader.getRowFromResultSet(Loader.java:287)
at org.hibernate.loader.Loader.doQuery(Loader.java:384)
at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:203)
at org.hibernate.loader.Loader.loadEntity(Loader.java:1255)
at org.hibernate.loader.entity.EntityLoader.load(EntityLoader.java:139)
at org.hibernate.loader.entity.EntityLoader.load(EntityLoader.java:124)
at org.hibernate.persister.entity.BasicEntityPersister.load(BasicEntityPersister.java:2453)
at org.hibernate.event.def.DefaultLoadEventListener.loadFromDatasource(DefaultLoadEventListener.java:387)
at org.hibernate.event.def.DefaultLoadEventListener.doLoad(DefaultLoadEventListener.java:368)
at org.hibernate.event.def.DefaultLoadEventListener.load(DefaultLoadEventListener.java:166)
at org.hibernate.event.def.DefaultLoadEventListener.load(DefaultLoadEventListener.java:140)
at org.hibernate.event.def.DefaultLoadEventListener.proxyOrLoad(DefaultLoadEventListener.java:249)
at org.hibernate.event.def.DefaultLoadEventListener.onLoad(DefaultLoadEventListener.java:123)
at org.hibernate.impl.SessionImpl.get(SessionImpl.java:561)
at org.hibernate.impl.SessionImpl.get(SessionImpl.java:556)
at com.siVault.siForms.BusinessObjects.base._BaseRootDAO.get(_BaseRootDAO.java:269)
at com.siVault.siForms.BusinessObjects.base._BaseRootDAO.get(_BaseRootDAO.java:258)
at com.siVault.siForms.BusinessObjects.base.BaseFasTransactionDAO.get(BaseFasTransactionDAO.java:43)
at com.siVault.siForms.persistence.DBPersistence.getFasTransaction(DBPersistence.java:61)
at com.siVault.siForms.persistence.HibernateDriver.main(HibernateDriver.java:67)
Caused by: java.lang.ClassCastException
at com.siVault.siForms.BusinessObjects.FormPage$$BulkBeanByCGLIB$$ffbe7696.getPropertyValues(<generated>)
at net.sf.cglib.beans.BulkBean.getPropertyValues(BulkBean.java:48)
at org.hibernate.tuple.PojoComponentTuplizer.getPropertyValues(PojoComponentTuplizer.java:39)
... 25 more


Jeevak


Top
 Profile  
 
 Post subject:
PostPosted: Sun Mar 27, 2005 4:28 am 
Senior
Senior

Joined: Sat Jul 17, 2004 5:16 pm
Posts: 143
You should be able to load an object with an empty collection. Try the hint it gives you (set hibernate.cglib.use_reflection_optimizer=false for more info). Chris


Top
 Profile  
 
 Post subject:
PostPosted: Sun Mar 27, 2005 1:41 pm 
Beginner
Beginner

Joined: Tue Jan 18, 2005 6:44 pm
Posts: 39
Hi chris,
Ive tried setting that property but it didnt help. It still threw the same error of not being able to load the collection.

Jeevak


Top
 Profile  
 
 Post subject:
PostPosted: Sun Mar 27, 2005 7:02 pm 
Senior
Senior

Joined: Sat Jul 17, 2004 5:16 pm
Posts: 143
jeeves21 wrote:
Hi chris,
Ive tried setting that property but it didnt help. It still threw the same error of not being able to load the collection.

Jeevak


I thought if you successfully set the property it doesnt use CGLIB and it cannot give a CGLIB exception... Chris

ps. in your stack trace it says classcastexception, does that mean a mismatch in the mapping types?

Caused by: java.lang.ClassCastException

If you can get CGLIB off, you will see which property is the problem


Top
 Profile  
 
 Post subject:
PostPosted: Mon Mar 28, 2005 4:06 pm 
Beginner
Beginner

Joined: Tue Jan 18, 2005 6:44 pm
Posts: 39
Hi chris,
I have the following property in my hibernate.cfg file.
<property name="hibernate.cglib.use_reflection_optimizer">false</property>

After the first time I got the error I have this set in my config file but the exception is still the same.

Jeevak


Top
 Profile  
 
 Post subject:
PostPosted: Mon Mar 28, 2005 6:41 pm 
Senior
Senior

Joined: Sat Jul 17, 2004 5:16 pm
Posts: 143
That looks right. I use a properties file (not xml) and it turns off CGLIB fine and gives me a better exception.

If you dont want to go that route, debug the code in your IDE and set a breakpoint there, and you will see which property has the problem, and you can troubleshoot that way. (something with a property mapping or Java or DB type)

Chris


Top
 Profile  
 
 Post subject:
PostPosted: Tue Mar 29, 2005 3:11 pm 
Beginner
Beginner

Joined: Tue Jan 18, 2005 6:44 pm
Posts: 39
The property is shown in the exception in my first post com.sivault.BusinessObjects.FormPage. The parent object is com.sivault.BusinessObjects.Form which tries to load a collection(set in this case) of FormPage objects. My first post shows the mapping I have used in the mapping file for Form.

Jeevak


Top
 Profile  
 
 Post subject:
PostPosted: Tue Mar 29, 2005 4:04 pm 
Senior
Senior

Joined: Sat Jul 17, 2004 5:16 pm
Posts: 143
ok, post the Java code, and the DDL in the DB, and the other relevant mapping file. Something might be mismatched. Thanks, Chris


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