hi, I have a problem using a query with reflectionOptimizer turned on. I keep getting the exceptions below.
What is it with the inner ClassCastException?
thanks alot
marie
- hibernate 2.1.3
----------------
QUERY
----------------
Query q = sess.getHibernateSession().createQuery("from c in class org.xinity.fwe.Gemeinde");
----------------
HBM.XML
----------------
<hibernate-mapping>
<class
name="org.xinity.fwe.GemeindeStub"
table="FWE_GEMEINDE"
>
...
<!-- RELATIONS-->
<!-- RELATION 'org.xinity.fwe.Gemeinde' 1 : m 'org.xinity.fwe.Gemarkung' (org.xinity.fwe.Gemeinde)-->
<set
name="Gemarkungen"
lazy="true"
inverse="false"
cascade="save-update"
>
<key
column="GEMEINDE_FK"
/>
<one-to-many
class="org.xinity.fwe.Gemarkung"
/>
</set>
...
<subclass
name="org.xinity.fwe.Gemeinde"
dynamic-update="false"
dynamic-insert="false"
discriminator-value="Gemeinde"
/>
</class>
</hibernate-mapping>
----------------
HBM.XML of related entity
----------------
<hibernate-mapping>
<class
name="org.xinity.fwe.GemarkungStub"
table="FWE_GEMARKUNG"
>
...
<!-- RELATIONS-->
<!-- RELATION 'org.xinity.fwe.Gemeinde' 1 : m 'org.xinity.fwe.Gemarkung' (org.xinity.fwe.Gemarkung)-->
<many-to-one
name="Gemeinde"
class="org.xinity.fwe.Gemeinde"
column="GEMEINDE_FK"
cascade="save-update"
/>
...
<subclass
name="org.xinity.fwe.Gemarkung"
dynamic-update="false"
dynamic-insert="false"
discriminator-value="Gemarkung"
/>
</class>
</hibernate-mapping>
----------------
BEAN
----------------
public Collection getGemarkungen() {
return gemarkungen;
}
public void setGemarkungen (Collection gemarkungen) {
this.gemarkungen = gemarkungen;
}
----------------
EXCEPTION
----------------
net.sf.hibernate.PropertyAccessException: exception setting property value with CGLIB (set hibernate.cglib.use_reflection_optimizer=false for more info) setter of org.xinity.fwe.Gemeinde.setGemarkungen
at net.sf.hibernate.persister.AbstractEntityPersister.setPropertyValues(AbstractEntityPersister.java:212)
at net.sf.hibernate.impl.SessionImpl.initializeEntity(SessionImpl.java:2199)
at net.sf.hibernate.loader.Loader.doQuery(Loader.java:240)
at net.sf.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:133)
at net.sf.hibernate.loader.Loader.doList(Loader.java:955)
at net.sf.hibernate.loader.Loader.list(Loader.java:946)
at net.sf.hibernate.hql.QueryTranslator.list(QueryTranslator.java:834)
at net.sf.hibernate.impl.SessionImpl.find(SessionImpl.java:1536)
at net.sf.hibernate.impl.QueryImpl.list(QueryImpl.java:39)
...
Caused by: net.sf.cglib.beans.BulkBeanException
at org.xinity.fwe.Gemeinde$$BulkBeanByCGLIB$$1f6c8ad0.setPropertyValues(<generated>)
at net.sf.hibernate.persister.AbstractEntityPersister.setPropertyValues(AbstractEntityPersister.java:207)
... 32 more
Caused by: java.lang.ClassCastException
... 34 more
----------------
DEBUGGING INFO
----------------
In AbstractEntityPersister.setPropertyValues(Object object, Object[] values):
object = [org.xinity.base.Gemarkung]
values = [Test, Test, null, [], [], null, null, null, null, null, 40288047fbeefa1b00fbeefae13e0013, 40288047fbeefa1b00fbeefae13e0013, 2004-05-17 19:57:52.0, 2004-05-17 20:03:16.0]
|