openjpa-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Marc Logemann ...@logemann.org>
Subject IntId cannot be cast to ContainerShipment with FetchType.EAGER
Date Mon, 29 Aug 2011 21:57:09 GMT
Hi,

aother openjpa thing. Most likely again not a bug but i will try ;-)

I have a normal 1:n relation in my ContainerShipment class which works pretty well.

    @OneToMany(mappedBy = "containerShipment", cascade = CascadeType.ALL)
    List<OrderPosition> orderPositions;

but as soon as i annotate with FetchType.EAGER...

    @OneToMany(mappedBy = "containerShipment", cascade = CascadeType.ALL, fetch = FetchType.EAGER)
    List<OrderPosition> orderPositions;

i get this stack trace and i really dont have a clue. I checked gazillions of things w/o success.
I also made sure that every record as a perfect relation so that i can be sure thats not a
data content issue. Any ideas?

org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
</pre></p><p><b>root cause</b> <pre>java.lang.ClassCastException:
org.apache.openjpa.util.IntId cannot be cast to de.logentis.bwh.model.ContainerShipment
	de.logentis.bwh.model.OrderPosition.pcReplaceField(OrderPosition.java)
	org.apache.openjpa.kernel.StateManagerImpl.replaceField(StateManagerImpl.java:3162)
	org.apache.openjpa.kernel.StateManagerImpl.storeObjectField(StateManagerImpl.java:2596)
	org.apache.openjpa.kernel.StateManagerImpl.storeObject(StateManagerImpl.java:2586)
	org.apache.openjpa.jdbc.kernel.JDBCStoreManager.setMappedBy(JDBCStoreManager.java:505)
	org.apache.openjpa.jdbc.kernel.JDBCStoreManager.initializeState(JDBCStoreManager.java:431)
	org.apache.openjpa.jdbc.kernel.JDBCStoreManager.initialize(JDBCStoreManager.java:333)
	org.apache.openjpa.kernel.DelegatingStoreManager.initialize(DelegatingStoreManager.java:112)
	org.apache.openjpa.kernel.ROPStoreManager.initialize(ROPStoreManager.java:57)
	org.apache.openjpa.kernel.BrokerImpl.initialize(BrokerImpl.java:1027)
	org.apache.openjpa.kernel.BrokerImpl.find(BrokerImpl.java:985)
	org.apache.openjpa.kernel.BrokerImpl.find(BrokerImpl.java:907)
	org.apache.openjpa.jdbc.kernel.JDBCStoreManager.load(JDBCStoreManager.java:1041)
	org.apache.openjpa.jdbc.sql.AbstractResult.load(AbstractResult.java:280)
	org.apache.openjpa.jdbc.sql.SelectImpl$SelectResult.load(SelectImpl.java:2381)
	org.apache.openjpa.jdbc.meta.strats.RelationToManyInverseKeyFieldStrategy.loadElement(RelationToManyInverseKeyFieldStrategy.java:90)
	org.apache.openjpa.jdbc.meta.strats.RelationCollectionInverseKeyFieldStrategy.loadElement(RelationCollectionInverseKeyFieldStrategy.java:76)
	org.apache.openjpa.jdbc.meta.strats.StoreCollectionFieldStrategy.processEagerParallelResult(StoreCollectionFieldStrategy.java:312)
	org.apache.openjpa.jdbc.meta.strats.StoreCollectionFieldStrategy.loadEagerParallel(StoreCollectionFieldStrategy.java:246)
	org.apache.openjpa.jdbc.meta.FieldMapping.loadEagerParallel(FieldMapping.java:916)
	org.apache.openjpa.jdbc.kernel.JDBCStoreManager.load(JDBCStoreManager.java:1114)
	org.apache.openjpa.jdbc.kernel.JDBCStoreManager.load(JDBCStoreManager.java:1067)
	org.apache.openjpa.jdbc.kernel.JDBCStoreManager.initializeState(JDBCStoreManager.java:438)
	org.apache.openjpa.jdbc.kernel.JDBCStoreManager.initialize(JDBCStoreManager.java:333)
	org.apache.openjpa.kernel.DelegatingStoreManager.initialize(DelegatingStoreManager.java:112)
	org.apache.openjpa.kernel.ROPStoreManager.initialize(ROPStoreManager.java:57)
	org.apache.openjpa.kernel.BrokerImpl.initialize(BrokerImpl.java:1027)
	org.apache.openjpa.kernel.BrokerImpl.find(BrokerImpl.java:985)
	org.apache.openjpa.kernel.BrokerImpl.find(BrokerImpl.java:907)
	org.apache.openjpa.jdbc.kernel.JDBCStoreManager.load(JDBCStoreManager.java:1041)
	org.apache.openjpa.jdbc.sql.AbstractResult.load(AbstractResult.java:280)
	org.apache.openjpa.jdbc.sql.SelectImpl$SelectResult.load(SelectImpl.java:2381)
	org.apache.openjpa.jdbc.sql.AbstractResult.load(AbstractResult.java:274)
	org.apache.openjpa.jdbc.kernel.InstanceResultObjectProvider.getResultObject(InstanceResultObjectProvider.java:59)
	org.apache.openjpa.kernel.QueryImpl$PackingResultObjectProvider.getResultObject(QueryImpl.java:2075)
	org.apache.openjpa.lib.rop.EagerResultList.&lt;init&gt;(EagerResultList.java:36)
	org.apache.openjpa.kernel.QueryImpl.toResult(QueryImpl.java:1251)
	org.apache.openjpa.kernel.QueryImpl.execute(QueryImpl.java:1007)
	org.apache.openjpa.kernel.QueryImpl.execute(QueryImpl.java:863)
	org.apache.openjpa.kernel.QueryImpl.execute(QueryImpl.java:794)
	org.apache.openjpa.kernel.DelegatingQuery.execute(DelegatingQuery.java:542)
	org.apache.openjpa.persistence.QueryImpl.execute(QueryImpl.java:315)
	org.apache.openjpa.persistence.QueryImpl.getResultList(QueryImpl.java:331)
	org.springframework.data.jpa.repository.support.SimpleJpaRepository.readPage(SimpleJpaRepository.java:434)
	org.springframework.data.jpa.repository.support.SimpleJpaRepository.findAll(SimpleJpaRepository.java:303)
	org.springframework.data.jpa.repository.support.SimpleJpaRepository.findAll(SimpleJpaRepository.java:260)
	sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	java.lang.reflect.Method.invoke(Method.java:597)
	org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.executeMethodOn(RepositoryFactorySupport.java:361)
	org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.invoke(RepositoryFactorySupport.java:342)
	org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
	org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:110)
	org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
	org.springframework.dao.support.PersistenceExceptionTranslationInterceptor.invoke(PersistenceExceptionTranslationInterceptor.java:155)
	org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
	org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202)
	$Proxy135.findAll(Unknown Source)
	de.netstorsys.controller.rest.ContainerShipmentRestController.showAll(ContainerShipmentRestController.java:51)
	sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	java.lang.reflect.Method.invoke(Method.java:597)
	org.springframework.web.bind.annotation.support.HandlerMethodInvoker.invokeHandlerMethod(HandlerMethodInvoker.java:176)
	org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.invokeHandlerMethod(AnnotationMethodHandlerAdapter.java:426)
	org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.handle(AnnotationMethodHandlerAdapter.java:414)
	org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:790)
	org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:719)
	org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:644)
	org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:549)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:690)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
	org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88)
	org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)

---
regards
Marc Logemann




Mime
View raw message