Hibernate Books

All times are UTC - 5 hours [ DST ]



Post new topic Reply to topic  [ 4 posts ] 
Author Message
 Post subject: PropertyAccessException with CGLib (not primitve pb)
PostPosted: Wed Sep 17, 2003 11:46 am 
Newbie

Joined: Mon Sep 01, 2003 1:22 pm
Posts: 16
Location: France
Hi,

I'm getting a PropertyAccessException from Hibernate when it tries to set a property with CGLib but all my primitive types are declared as NOT NULL. Here is the exception :

Code:
org.smartcomps.twister.common.persistence.DBSessionExecutionException: net.sf.hibernate.PropertyAccessException: exception setting property value with CGLIB setter of org.smartcomps.twister.engine.priv.core.dynamic.impl.InvokeECImpl.?
   at org.smartcomps.twister.engine.priv.core.dynamic.impl.dao.ProcessInstanceDAO.findInstanceByCorrelation(ProcessInstanceDAO.java:38)
   at org.smartcomps.twister.engine.priv.core.dynamic.ProcessInstanceFactory.findInstanceByCorrelation(ProcessInstanceFactory.java:95)
   at org.smartcomps.twister.engine.core.dynamic.TestSequenceEC.testExecute(TestSequenceEC.java:54)
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
   at java.lang.reflect.Method.invoke(Method.java:324)
   at junit.framework.TestCase.runTest(TestCase.java:154)
   at junit.framework.TestCase.runBare(TestCase.java:127)
   at junit.framework.TestResult$1.protect(TestResult.java:106)
   at junit.framework.TestResult.runProtected(TestResult.java:124)
   at junit.framework.TestResult.run(TestResult.java:109)
   at junit.framework.TestCase.run(TestCase.java:118)
   at junit.framework.TestSuite.runTest(TestSuite.java:208)
   at junit.framework.TestSuite.run(TestSuite.java:203)
   at junit.textui.TestRunner.doRun(TestRunner.java:116)
   at junit.textui.TestRunner.start(TestRunner.java:172)
   at com.intellij.rt.execution.junit.TextTestRunner.main(TextTestRunner.java:12)
Caused by: net.sf.hibernate.PropertyAccessException: exception setting property value with CGLIB setter of org.smartcomps.twister.engine.priv.core.dynamic.impl.InvokeECImpl.?
   at net.sf.hibernate.persister.AbstractEntityPersister.setPropertyValues(AbstractEntityPersister.java:163)
   at net.sf.hibernate.impl.SessionImpl.initializeEntity(SessionImpl.java:1973)
   at net.sf.hibernate.loader.Loader.doFind(Loader.java:196)
   at net.sf.hibernate.loader.Loader.loadCollection(Loader.java:588)
   at net.sf.hibernate.loader.OneToManyLoader.initialize(OneToManyLoader.java:102)
   at net.sf.hibernate.impl.SessionImpl.initialize(SessionImpl.java:2844)
   at net.sf.hibernate.collection.PersistentCollection.getInitialValue(PersistentCollection.java:128)
   at net.sf.hibernate.type.PersistentCollectionType.getCollection(PersistentCollectionType.java:70)
   at net.sf.hibernate.type.PersistentCollectionType.resolveIdentifier(PersistentCollectionType.java:170)
   at net.sf.hibernate.impl.SessionImpl.initializeEntity(SessionImpl.java:1971)
   at net.sf.hibernate.loader.Loader.doFind(Loader.java:196)
   at net.sf.hibernate.loader.Loader.loadCollection(Loader.java:588)
   at net.sf.hibernate.loader.OneToManyLoader.initialize(OneToManyLoader.java:102)
   at net.sf.hibernate.impl.SessionImpl.initialize(SessionImpl.java:2844)
   at net.sf.hibernate.collection.PersistentCollection.getInitialValue(PersistentCollection.java:128)
   at net.sf.hibernate.type.PersistentCollectionType.getCollection(PersistentCollectionType.java:70)
   at net.sf.hibernate.type.PersistentCollectionType.resolveIdentifier(PersistentCollectionType.java:170)
   at net.sf.hibernate.impl.SessionImpl.initializeEntity(SessionImpl.java:1971)
   at net.sf.hibernate.loader.Loader.doFind(Loader.java:196)
   at net.sf.hibernate.loader.Loader.loadEntity(Loader.java:573)
   at net.sf.hibernate.loader.EntityLoader.load(EntityLoader.java:42)
   at net.sf.hibernate.persister.EntityPersister.load(EntityPersister.java:392)
   at net.sf.hibernate.impl.SessionImpl.doLoad(SessionImpl.java:1901)
   at net.sf.hibernate.impl.SessionImpl.doLoadByClass(SessionImpl.java:1769)
   at net.sf.hibernate.impl.SessionImpl.internalLoad(SessionImpl.java:1728)
   at net.sf.hibernate.type.ManyToOneType.resolveIdentifier(ManyToOneType.java:62)
   at net.sf.hibernate.impl.SessionImpl.initializeEntity(SessionImpl.java:1971)
   at net.sf.hibernate.loader.Loader.doFind(Loader.java:196)
   at net.sf.hibernate.loader.Loader.find(Loader.java:606)
   at net.sf.hibernate.hql.QueryTranslator.find(QueryTranslator.java:912)
   at net.sf.hibernate.impl.SessionImpl.find(SessionImpl.java:1356)
   at net.sf.hibernate.impl.QueryImpl.list(QueryImpl.java:76)
   at org.smartcomps.twister.engine.priv.core.dynamic.impl.dao.ProcessInstanceDAO.findInstanceByCorrelation(ProcessInstanceDAO.java:36)
   ... 17 more
Caused by: java.lang.ClassCastException
   at org.smartcomps.twister.engine.priv.core.dynamic.impl.InvokeECImplMetaClass3.setPropertyValues(<generated>)
   at net.sf.hibernate.persister.AbstractEntityPersister.setPropertyValues(AbstractEntityPersister.java:158)
   ... 49 more


And here is my mapping (note that all primitive types are not null) :

Code:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
        "-//Hibernate/Hibernate Mapping DTD//EN"
        "http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd">

<hibernate-mapping>
    <class name="org.smartcomps.twister.engine.priv.core.dynamic.impl.ExecutionContextImpl" table="EXEC_CONTEXT">
        <id name="id" column="ID" type="long">
            <generator class="hilo">
                <param name="table">CONTEXT_ID</param>
                <param name="column">NEXT</param>
            </generator>
        </id>
        <discriminator column="TYPE"/>

        <property name="status" type="int" not-null="true"/>
        <property name="index" type="int" column="POS" not-null="true"/>

        <set name="processInstance" inverse="true">
            <key column="EC_ID"/>
            <one-to-many class="org.smartcomps.twister.engine.priv.core.dynamic.impl.ProcessInstanceImpl"/>
        </set>
      <many-to-one name="container"
         class="org.smartcomps.twister.engine.priv.core.definition.impl.StructuredActivityImpl" column="CONTAINER_ID"/>

        <subclass name="org.smartcomps.twister.engine.priv.core.dynamic.impl.WaitECImpl" discriminator-value="WAITEC">
         <property name="dueDate" type="timestamp"/>
        </subclass>
        <subclass name="org.smartcomps.twister.engine.priv.core.dynamic.impl.InvokeECImpl" discriminator-value="INVOKEEC">
        </subclass>

      <subclass name="org.smartcomps.twister.engine.priv.core.dynamic.impl.StructuredECImpl" discriminator-value="STRUCTEC">
         <set name="executionContextsSet" inverse="true" order-by="POS asc">
            <key column="CONTAINER_ID"/>
            <one-to-many class="org.smartcomps.twister.engine.priv.core.dynamic.impl.ExecutionContextImpl"/>
         </set>
         <many-to-one name="activity"
            class="org.smartcomps.twister.engine.priv.core.definition.impl.StructuredActivityImpl" column="STRUCT_ACT_ID"/>

         <subclass name="org.smartcomps.twister.engine.priv.core.dynamic.impl.SequenceECImpl" discriminator-value="SEQEC">            
         </subclass>
      </subclass>

    </class>
</hibernate-mapping>


Thanks for any help though, debugging this stuff is a nightmare (I even couldn't disable CGLib with the
hibernate.cglib.use_reflection_optimizer property in hibernate config file though).

Matt.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Sep 17, 2003 12:40 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
This property must go into hibernate.properties. See the Javadoc for the Environment class.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Sep 17, 2003 12:42 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 3:00 pm
Posts: 1812
Location: Austin, TX
You are getting a ClassCastException. What is org.smartcomps.twister.engine.priv.core.dynamic.impl.InvokeECImplMetaClass3.setPropertyValues() trying to do? Thats where the ClassCastException originates from.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Sep 17, 2003 1:45 pm 
Newbie

Joined: Mon Sep 01, 2003 1:22 pm
Posts: 16
Location: France
Yes, I saw the NullPointerException in the stacktrace but the InvokeECImplMetaClass3 is generated by hibernate and CGLib, it's not one of my classes, I have no way to see what it's doing (as it's dynamically generated).


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 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.