Hi there,
I'm having following exception when loading my entity
Code:
org.springframework.orm.hibernate3.HibernateSystemException: IllegalArgumentException occurred calling getter of com.bmw.auspuffanlagen.mode
l.CompositePK.vorgangsnr; nested exception is org.hibernate.PropertyAccessException: IllegalArgumentException occurred calling getter of com
.bmw.auspuffanlagen.model.CompositePK.vorgangsnr
Caused by: org.hibernate.PropertyAccessException: IllegalArgumentException occurred calling getter of com.bmw.auspuffanlagen.model.Composite
PK.vorgangsnr
at org.hibernate.property.BasicPropertyAccessor$BasicGetter.get(BasicPropertyAccessor.java:171)
at org.hibernate.tuple.AbstractComponentTuplizer.getPropertyValue(AbstractComponentTuplizer.java:58)
at org.hibernate.tuple.AbstractComponentTuplizer.getPropertyValues(AbstractComponentTuplizer.java:64)
at org.hibernate.tuple.PojoComponentTuplizer.getPropertyValues(PojoComponentTuplizer.java:76)
at org.hibernate.type.ComponentType.getPropertyValues(ComponentType.java:307)
at org.hibernate.type.ComponentType.getHashCode(ComponentType.java:158)
at org.hibernate.engine.EntityKey.generateHashCode(EntityKey.java:104)
at org.hibernate.engine.EntityKey.<init>(EntityKey.java:48)
at org.hibernate.engine.StatefulPersistenceContext.getCollectionOwner(StatefulPersistenceContext.java:644)
at org.hibernate.loader.Loader.readCollectionElement(Loader.java:980)
at org.hibernate.loader.Loader.readCollectionElements(Loader.java:635)
at org.hibernate.loader.Loader.getRowFromResultSet(Loader.java:580)
at org.hibernate.loader.Loader.doQuery(Loader.java:689)
at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:224)
at org.hibernate.loader.Loader.loadCollection(Loader.java:1919)
at org.hibernate.loader.collection.CollectionLoader.initialize(CollectionLoader.java:36)
at org.hibernate.persister.collection.AbstractCollectionPersister.initialize(AbstractCollectionPersister.java:541)
at org.hibernate.event.def.DefaultInitializeCollectionEventListener.onInitializeCollection(DefaultInitializeCollectionEventListener.
java:60)
at org.hibernate.impl.SessionImpl.initializeCollection(SessionImpl.java:1705)
at org.hibernate.type.CollectionType.getCollection(CollectionType.java:507)
at org.hibernate.type.CollectionType.resolveKey(CollectionType.java:341)
at org.hibernate.type.CollectionType.resolve(CollectionType.java:335)
at org.hibernate.engine.TwoPhaseLoad.initializeEntity(TwoPhaseLoad.java:116)
at org.hibernate.loader.Loader.initializeEntitiesAndCollections(Loader.java:842)
at org.hibernate.loader.Loader.doQuery(Loader.java:717)
at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:224)
at org.hibernate.loader.Loader.doList(Loader.java:2145)
at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2029)
at org.hibernate.loader.Loader.list(Loader.java:2024)
at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:392)
at org.hibernate.hql.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:333)
at org.hibernate.engine.query.HQLQueryPlan.performList(HQLQueryPlan.java:172)
at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1114)
at org.hibernate.impl.QueryImpl.list(QueryImpl.java:79)
at org.springframework.orm.hibernate3.HibernateTemplate$29.doInHibernate(HibernateTemplate.java:837)
at org.springframework.orm.hibernate3.HibernateTemplate.execute(HibernateTemplate.java:366)
at org.springframework.orm.hibernate3.HibernateTemplate.find(HibernateTemplate.java:828)
at org.springframework.orm.hibernate3.HibernateTemplate.find(HibernateTemplate.java:820)
at com.bmw.auspuffanlagen.dao.hibernate.AbstractHibernateLayer.find(AbstractHibernateLayer.java:62)
at com.bmw.auspuffanlagen.dao.hibernate.HibernateBeschaffungDao.getBeschaffungList(HibernateBeschaffungDao.java:21)
at com.bmw.auspuffanlagen.dao.hibernate.HibernateBeschaffungDao$$FastClassByCGLIB$$4a9e26d5.invoke(<generated>)
at net.sf.cglib.proxy.MethodProxy.invoke(MethodProxy.java:149)
at org.springframework.aop.framework.Cglib2AopProxy$CglibMethodInvocation.invokeJoinpoint(Cglib2AopProxy.java:709)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:148)
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:100)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:170)
at org.springframework.aop.framework.Cglib2AopProxy$DynamicAdvisedInterceptor.intercept(Cglib2AopProxy.java:647)
at com.bmw.auspuffanlagen.dao.hibernate.HibernateBeschaffungDao$$EnhancerByCGLIB$$50c66d4f.getBeschaffungList(<generated>)
at com.bmw.auspuffanlagen.service.impl.BeschaffungManagerImpl.getBeschaffungen(BeschaffungManagerImpl.java:26)
at com.bmw.auspuffanlagen.view.BeschaffungController.showFormInternal(BeschaffungController.java:30)
at com.bmw.auspuffanlagen.view.SuchFilterFormController.showForm(SuchFilterFormController.java:52)
at org.springframework.web.servlet.mvc.AbstractFormController.showNewForm(AbstractFormController.java:323)
at org.springframework.web.servlet.mvc.AbstractFormController.handleRequestInternal(AbstractFormController.java:263)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:266)
at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:181)
at org.springframework.aop.framework.Cglib2AopProxy$CglibMethodInvocation.invokeJoinpoint(Cglib2AopProxy.java:706)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:148)
at org.springframework.aop.support.DelegatingIntroductionInterceptor.doProceed(DelegatingIntroductionInterceptor.java:124)
at org.springframework.aop.support.DelegatingIntroductionInterceptor.invoke(DelegatingIntroductionInterceptor.java:112)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:170)
at org.springframework.aop.framework.Cglib2AopProxy$DynamicAdvisedInterceptor.intercept(Cglib2AopProxy.java:647)
at com.bmw.auspuffanlagen.view.BeschaffungController$$EnhancerByCGLIB$$43655e19_2.handleRequestInternal(<generated>)
at org.springframework.web.servlet.mvc.AbstractController.handleRequest(AbstractController.java:153)
at org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter.handle(SimpleControllerHandlerAdapter.java:45)
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:798)
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:728)
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:396)
at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:350)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at org.extremecomponents.table.filter.AbstractExportFilter.doFilter(AbstractExportFilter.java:49)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at com.opensymphony.module.sitemesh.filter.PageFilter.parsePage(PageFilter.java:118)
at com.opensymphony.module.sitemesh.filter.PageFilter.doFilter(PageFilter.java:52)
at org.extremecomponents.table.filter.SitemeshPageFilter.doFilter(SitemeshPageFilter.java:39)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:61)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:77)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at org.springframework.orm.hibernate3.support.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java:174)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:77)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.IllegalArgumentException: java.lang.ClassCastException@52ded2
at sun.reflect.GeneratedMethodAccessor174.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.hibernate.property.BasicPropertyAccessor$BasicGetter.get(BasicPropertyAccessor.java:145)
... 103 more
my entity mapping looks like this
Code:
<class name="Beschaffung"
table="ABGASANLAGE_BESCHAFFUNGEN">
<composite-id name="compositePK" class="com.bmw.auspuffanlagen.model.CompositePK">
<key-property name="vorgangsnr"/>
<key-property name="positionsnr"/>
<key-property name="staffelnr"/>
</composite-id>
<property name="sollLt" />
<property name="wunschLt" />
<property name="erledigungsdatum"/>
<property name="sachnr" column="SACHNR"/>
<array
table="vtzabe"
name="kommentar"
>
<key
column="snr"
property-ref="sachnr"
>
</key>
<index column="bemnr"/>
<element
column="bemtx"
type="string"
not-null="false"
unique="false"
/>
</array>
<property name="bezeichnung" />
<property name="ai" />
<property name="etyp" />
<property name="bg" />
<property name="anlagentyp" />
<property name="exemplarnr" column="EXEMPLARNR"/>
<property name="dauer"
formula="(select round(to_number(sollLt-erledigungsdatum)) from dual)" />
<property name="status"
formula="(select case when (round(to_number(sollLt-erledigungsdatum)) >= -1) then 'ok'
when (round(to_number(sollLt-erledigungsdatum)) between -3 and -2) then 'verzug'
when (round(to_number(sollLt-erledigungsdatum)) between -9999 and -4) then 'verspätet'
else '' END from dual)" />
</class>
So when I try to load the entity, it throws the above error. When I change my entity mapping to a simple id it works fine, just the composite id mapping throws the exception, because when i debug it i see that in the BasicGetter it tries to get the first property of the composite id by reflection with a target that is the property-ref of the array mapping.
Did I miss something or is it a bug?
Thanks for your help.
Domink[/code]