-->
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.  [ 2 posts ] 
Author Message
 Post subject: Strange Hibernate exception with CGLIB
PostPosted: Mon Feb 21, 2011 6:53 pm 
Newbie

Joined: Mon Jan 09, 2006 1:18 pm
Posts: 4
Hi,
We are suddenly receiving the following exception in our production app when executing a named query which simply loads a collection of Org objects:
Code:
Caused by:   
org.springframework.orm.hibernate3.HibernateSystemException: exception setting property value with CGLIB (set hibernate.cglib.use_reflection_optimizer=false for more info) setter of com.mycompany.model.hibernate.Org.setVrsnNbr; nested exception is org.hibernate.PropertyAccessException: exception setting property value with CGLIB (set hibernate.cglib.use_reflection_optimizer=false for more info) setter of com.mycompany.model.hibernate.Org.setVrsnNbr   
    at org.springframework.orm.hibernate3.SessionFactoryUtils.convertHibernateAccessException(SessionFactoryUtils.java:670)   
    at org.springframework.orm.hibernate3.HibernateAccessor.convertHibernateAccessException(HibernateAccessor.java:407)   
    at org.springframework.orm.hibernate3.HibernateTemplate.execute(HibernateTemplate.java:372)   
    at org.springframework.orm.hibernate3.HibernateTemplate.findByNamedQuery(HibernateTemplate.java:902)   
    at com.mycompany.model.dao.hibernate.CommonDao.findNamedQuery(CommonDao.java:372)   
    at sun.reflect.GeneratedMethodAccessor166.invoke(Unknown Source)   
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)   
    at java.lang.reflect.Method.invoke(Method.java:618)   
    at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:281)   
    at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:187)   
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:154)   
    at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:107)   
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:176)   
    at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:210)   
    at $Proxy8.findNamedQuery(Unknown Source)   
    at com.mycompany.model.service.MyFileConfig.populateOrgMap(MyFileConfig.java:2544)   
    .. 60 more   
Caused by:   
org.hibernate.PropertyAccessException: exception setting property value with CGLIB (set hibernate.cglib.use_reflection_optimizer=false for more info) setter of com.mycompany.model.hibernate.Org.setVrsnNbr   
    at org.hibernate.tuple.PojoTuplizer.setPropertyValuesWithOptimizer(PojoTuplizer.java:203)   
    at org.hibernate.tuple.PojoTuplizer.setPropertyValues(PojoTuplizer.java:173)   
    at org.hibernate.persister.entity.BasicEntityPersister.setPropertyValues(BasicEntityPersister.java:2919)   
    at org.hibernate.engine.TwoPhaseLoad.initializeEntity(TwoPhaseLoad.java:113)   
    at org.hibernate.loader.Loader.initializeEntitiesAndCollections(Loader.java:530)   
    at org.hibernate.loader.Loader.doQuery(Loader.java:436)   
    at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:218)   
    at org.hibernate.loader.Loader.doList(Loader.java:1593)   
    at org.hibernate.loader.Loader.list(Loader.java:1577)   
    at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:395)   
    at org.hibernate.hql.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:271)   
    at org.hibernate.impl.SessionImpl.list(SessionImpl.java:844)   
    at org.hibernate.impl.QueryImpl.list(QueryImpl.java:74)   
    at org.springframework.orm.hibernate3.HibernateTemplate$32.doInHibernate(HibernateTemplate.java:911)   
    at org.springframework.orm.hibernate3.HibernateTemplate.execute(HibernateTemplate.java:367)   
    .. 73 more   
Caused by:   
net.sf.cglib.beans.BulkBeanException   
    at com.mycompany.model.hibernate.Org$$BulkBeanByCGLIB$$f3cf08e7.setPropertyValues(<generated>)   
    at org.hibernate.tuple.PojoTuplizer.setPropertyValuesWithOptimizer(PojoTuplizer.java:200)   
    .. 87 more   
Caused by:   
java.lang.NullPointerException   
    .. 89 more 
Caused by:
org.springframework.orm.hibernate3.HibernateSystemException: exception setting property value with CGLIB (set hibernate.cglib.use_reflection_optimizer=false for more info) setter of com.mycompany.model.hibernate.Org.setVrsnNbr; nested exception is org.hibernate.PropertyAccessException: exception setting property value with CGLIB (set hibernate.cglib.use_reflection_optimizer=false for more info) setter of com.mycompany.model.hibernate.Org.setVrsnNbr
   at org.springframework.orm.hibernate3.SessionFactoryUtils.convertHibernateAccessException(SessionFactoryUtils.java:670)
   at org.springframework.orm.hibernate3.HibernateAccessor.convertHibernateAccessException(HibernateAccessor.java:407)
   at org.springframework.orm.hibernate3.HibernateTemplate.execute(HibernateTemplate.java:372)
   at org.springframework.orm.hibernate3.HibernateTemplate.findByNamedQuery(HibernateTemplate.java:902)
   at com.mycompany.model.dao.hibernate.CommonDao.findNamedQuery(CommonDao.java:372)
   at sun.reflect.GeneratedMethodAccessor166.invoke(Unknown Source)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
   at java.lang.reflect.Method.invoke(Method.java:618)
   at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:281)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:187)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:154)
   at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:107)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:176)
   at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:210)
   at $Proxy8.findNamedQuery(Unknown Source)
   at com.mycompany.model.service.MyFileConfig.populateOrgMap(MyFileConfig.java:2544)
   .. 60 more
Caused by:
org.hibernate.PropertyAccessException: exception setting property value with CGLIB (set hibernate.cglib.use_reflection_optimizer=false for more info) setter of com.mycompany.model.hibernate.Org.setVrsnNbr
   at org.hibernate.tuple.PojoTuplizer.setPropertyValuesWithOptimizer(PojoTuplizer.java:203)
   at org.hibernate.tuple.PojoTuplizer.setPropertyValues(PojoTuplizer.java:173)
   at org.hibernate.persister.entity.BasicEntityPersister.setPropertyValues(BasicEntityPersister.java:2919)
   at org.hibernate.engine.TwoPhaseLoad.initializeEntity(TwoPhaseLoad.java:113)
   at org.hibernate.loader.Loader.initializeEntitiesAndCollections(Loader.java:530)
   at org.hibernate.loader.Loader.doQuery(Loader.java:436)
   at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:218)
   at org.hibernate.loader.Loader.doList(Loader.java:1593)
   at org.hibernate.loader.Loader.list(Loader.java:1577)
   at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:395)
   at org.hibernate.hql.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:271)
   at org.hibernate.impl.SessionImpl.list(SessionImpl.java:844)
   at org.hibernate.impl.QueryImpl.list(QueryImpl.java:74)
   at org.springframework.orm.hibernate3.HibernateTemplate$32.doInHibernate(HibernateTemplate.java:911)
   at org.springframework.orm.hibernate3.HibernateTemplate.execute(HibernateTemplate.java:367)
   .. 73 more
Caused by:
net.sf.cglib.beans.BulkBeanException
   at com.mycompany.model.hibernate.Org$$BulkBeanByCGLIB$$f3cf08e7.setPropertyValues(<generated>)
   at org.hibernate.tuple.PojoTuplizer.setPropertyValuesWithOptimizer(PojoTuplizer.java:200)
   .. 87 more
Caused by:
java.lang.NullPointerException
   .. 89 more



We have the vrsnNbr column defined as not null in the database and there are no records that have a null vrsnNbr.

Here is the mapping file:
Code:
<?xml version="1.0" encoding="UTF-8"?>   
 
<!DOCTYPE hibernate-mapping PUBLIC   
    "-//Hibernate/Hibernate Mapping DTD 3.0//EN"   
    "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">   
 
<hibernate-mapping   
>   
    <class 
        name="com.mycompany.model.hibernate.Org" table="ORG" 
    >   
        <id   
            name="orgId" 
            column="ORG_ID" 
            type="java.lang.Integer" 
        >   
            <generator class="com.mycompany.idgen.SeqPreAllocGen">   
                <param name="sequence">ORG_SEQ</param>   
                <param name="max_lo">50</param>   
            </generator>   
        </id>   
 
        <version   
            name="vrsnNbr" 
            column="VRSN_NBR" 
            type="int" 
        /> 


After googling for many hours I cannot seem to make sense of this exception. Any ideas would be welcomed!

Thanks-


Top
 Profile  
 
 Post subject: Re: Strange Hibernate exception with CGLIB
PostPosted: Tue Feb 22, 2011 4:49 pm 
Newbie

Joined: Mon Jan 09, 2006 1:18 pm
Posts: 4
I found out the cause to this issue. It is not the same issue most people are experiencing, according to google. Maybe it will help somebody.

Our named query was returning NULL for a not-null column in a result set. We had to look at the sql hibernate was generating to determine this.

When we ran the sql manually in Sql Developer and sure enough we saw the NULL. This is an Oracle bug and our DBAs have opened a trouble ticket with Oracle.

Thanks-


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