Using JBoss-4.2.2.GA. Using a uni-directional OneToOne Relation between two entities with a composite PK.
First class: @Entity | @IdClass(value=MbiMsgpa.PK.class) | @Table(name="mbi_msgpa") | public class MbiMsgpa implements java.io.Serializable | { | @Id | @Column(name="msghd_serial") | private java.lang.Integer msghdSerial; | | @Id | @Column(name="part_no") | private java.lang.Integer partNo; | | @Column(name="message_type") | private java.lang.String messageType; | | @Column(name="source") | private java.lang.String source; | | /** Field line. */ | @Column(name="line") | private java.lang.Integer line; | | @Column(name="time_created") | private java.util.Date timeCreated; | | @Column(name="bp_task_id") | private java.lang.Integer bpTaskId; | | @OneToOne(cascade=CascadeType.ALL,fetch=FetchType.LAZY) | @JoinColumns({ | @JoinColumn(name="msghd_serial",referencedColumnName="msghd_serial",insertable=false,updatable=false), | @JoinColumn(name="part_no",referencedColumnName="part_no",insertable=false,updatable=false) | }) | private MbiMsgpt mbiMsgpt; | .... | Second class is @Entity | @IdClass(value=MbiMsgpt.PK.class) | @Table(name="mbi_msgpt") | public class MbiMsgpt implements java.io.Serializable | { | @Id | @Column(name="msghd_serial") | private java.lang.Integer msghdSerial; | | @Id | @Column(name="part_no") | private java.lang.Integer partNo; | ... | Using this, I get exceptions like this: 2007-09-13 17:51:14,832 INFO [biz.mbisoftware.fn.ejb.session.core.MessageSink] Calling MessageSink.appendMessage(INFO, 4756, [1.2007-09-13 17:51:14.mbi_distol.ec.282.null[Verarbeitung beendet]]) | 2007-09-13 17:51:14,836 INFO [STDOUT] Hibernate: select mbimsghd0_.msghd_serial as msghd1_99_0_, mbimsghd0_.session_id as session2_99_0_, mbimsghd0_.process_id as process3_99_0_, mbimsghd0_.hostname as hostname99_0_, mbimsghd0_.time_created as time5_99_0_, mbimsghd0_.login_bez_created as login6_99_0_, mbimsghd0_.state as state99_0_, mbimsghd0_.bp_id as bp8_99_0_, mbimsghd0_.iso_sprach_id as iso9_99_0_, mbimsghd0_.iso_sprach_id_def as iso10_99_0_, mbimsghd0_.adress_nr as adress11_99_0_ from mbi_msghd mbimsghd0_ where mbimsghd0_.msghd_serial=? | 2007-09-13 17:51:14,859 INFO [STDOUT] Hibernate: select mbimsgpa0_.msghd_serial as msghd1_1_, mbimsgpa0_.part_no as part2_1_, mbimsgpa0_.msghd_serial as msghd1_101_0_, mbimsgpa0_.part_no as part2_101_0_, mbimsgpa0_.message_type as message3_101_0_, mbimsgpa0_.source as source101_0_, mbimsgpa0_.line as line101_0_, mbimsgpa0_.time_created as time6_101_0_, mbimsgpa0_.bp_task_id as bp7_101_0_ from mbi_msgpa mbimsgpa0_ where mbimsgpa0_.msghd_serial=? order by mbimsgpa0_.msghd_serial asc, mbimsgpa0_.part_no asc | 2007-09-13 17:51:14,887 WARN [org.hibernate.engine.loading.LoadContexts] fail-safe cleanup (collections) : [EMAIL PROTECTED]<[EMAIL PROTECTED]> | 2007-09-13 17:51:14,887 WARN [org.hibernate.engine.loading.CollectionLoadContext] On CollectionLoadContext#cleanup, localLoadingCollectionKeys contained [1] entries | 2007-09-13 17:51:14,896 ERROR [org.jboss.ws.core.jaxws.SOAPFaultHelperJAXWS] SOAP request exception | javax.ejb.EJBException: org.hibernate.TypeMismatchException: Provided id of the wrong type. Expected: class biz.mbisoftware.fn.ejb.entity.MbiMsgpt$PK, got class biz.mbisoftware.fn.ejb.entity.MbiMsgpa$PK | at org.jboss.ejb3.tx.Ejb3TxPolicy.handleExceptionInOurTx(Ejb3TxPolicy.java:63) | at org.jboss.aspects.tx.TxPolicy.invokeInOurTx(TxPolicy.java:83) | at org.jboss.aspects.tx.TxInterceptor$RequiresNew.invoke(TxInterceptor.java:262) | at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101) | at org.jboss.aspects.tx.TxPropagationInterceptor.invoke(TxPropagationInterceptor.java:95) | at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101) | at org.jboss.ejb3.stateless.StatelessInstanceInterceptor.invoke(StatelessInstanceInterceptor.java:62) | at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101) | at org.jboss.aspects.security.AuthenticationInterceptor.invoke(AuthenticationInterceptor.java:77) | at org.jboss.ejb3.security.Ejb3AuthenticationInterceptor.invoke(Ejb3AuthenticationInterceptor.java:106) | at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101) | at org.jboss.ejb3.ENCPropagationInterceptor.invoke(ENCPropagationInterceptor.java:46) | at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101) | at org.jboss.ejb3.asynchronous.AsynchronousInterceptor.invoke(AsynchronousInterceptor.java:106) | at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101) | at org.jboss.ejb3.stateless.StatelessContainer.localInvoke(StatelessContainer.java:214) | at org.jboss.ejb3.stateless.StatelessContainer.localInvoke(StatelessContainer.java:184) | at org.jboss.ejb3.stateless.StatelessLocalProxy.invoke(StatelessLocalProxy.java:84) | at $Proxy193.appendMessage(Unknown Source) | at biz.mbisoftware.fn.ws.core.MessageServiceWS.appendMessage(MessageServiceWS.java:84) | at biz.mbisoftware.fn.ws.core.MessageServiceWS.appendInfo(MessageServiceWS.java:178) | 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:585) | at org.jboss.ws.core.server.ServiceEndpointInvokerJSE.invokeServiceEndpointInstance(ServiceEndpointInvokerJSE.java:104) | at org.jboss.ws.core.server.AbstractServiceEndpointInvoker.invoke(AbstractServiceEndpointInvoker.java:207) | at org.jboss.ws.core.server.ServiceEndpointInvokerJSE.invokeServiceEndpointInstance(ServiceEndpointInvokerJSE.java:104) | at org.jboss.ws.core.server.AbstractServiceEndpointInvoker.invoke(AbstractServiceEndpointInvoker.java:207) | at org.jboss.ws.core.server.ServiceEndpoint.processRequest(ServiceEndpoint.java:212) | at org.jboss.ws.core.server.ServiceEndpointManager.processRequest(ServiceEndpointManager.java:448) | at org.jboss.ws.core.server.AbstractServiceEndpointServlet.doPost(AbstractServiceEndpointServlet.java:114) | at javax.servlet.http.HttpServlet.service(HttpServlet.java:710) | at org.jboss.ws.core.server.AbstractServiceEndpointServlet.service(AbstractServiceEndpointServlet.java:75) | at javax.servlet.http.HttpServlet.service(HttpServlet.java:803) | at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290) | at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) | at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96) | at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) | at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) | at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230) | at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175) | at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:179) | at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84) | at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127) | at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) | at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157) | at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) | at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:262) | at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844) | at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583) | at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:446) | at java.lang.Thread.run(Thread.java:595) | Caused by: org.hibernate.TypeMismatchException: Provided id of the wrong type. Expected: class biz.mbisoftware.fn.ejb.entity.MbiMsgpt$PK, got class biz.mbisoftware.fn.ejb.entity.MbiMsgpa$PK | at org.hibernate.event.def.DefaultLoadEventListener.onLoad(DefaultLoadEventListener.java:86) | at org.hibernate.impl.SessionImpl.fireLoad(SessionImpl.java:878) | at org.hibernate.impl.SessionImpl.internalLoad(SessionImpl.java:846) | at org.hibernate.type.EntityType.resolveIdentifier(EntityType.java:557) | at org.hibernate.type.EntityType.resolve(EntityType.java:379) | at org.hibernate.engine.TwoPhaseLoad.initializeEntity(TwoPhaseLoad.java:116) | at org.hibernate.loader.Loader.initializeEntitiesAndCollections(Loader.java:854) | at org.hibernate.loader.Loader.doQuery(Loader.java:729) | at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:236) | at org.hibernate.loader.Loader.loadCollection(Loader.java:1994) | at org.hibernate.loader.collection.CollectionLoader.initialize(CollectionLoader.java:36) | at org.hibernate.persister.collection.AbstractCollectionPersister.initialize(AbstractCollectionPersister.java:565) | at org.hibernate.event.def.DefaultInitializeCollectionEventListener.onInitializeCollection(DefaultInitializeCollectionEventListener.java:60) | at org.hibernate.impl.SessionImpl.initializeCollection(SessionImpl.java:1716) | at org.hibernate.collection.AbstractPersistentCollection.initialize(AbstractPersistentCollection.java:344) | at org.hibernate.collection.AbstractPersistentCollection.read(AbstractPersistentCollection.java:86) | at org.hibernate.collection.AbstractPersistentCollection.readSize(AbstractPersistentCollection.java:109) | at org.hibernate.collection.PersistentBag.size(PersistentBag.java:225) | at org.hibernate.collection.AbstractPersistentCollection.readSize(AbstractPersistentCollection.java:109) | at org.hibernate.collection.PersistentBag.size(PersistentBag.java:225) | at biz.mbisoftware.fn.ejb.session.core.MessageSink.storeMessagePart(MessageSink.java:167) | at biz.mbisoftware.fn.ejb.session.core.MessageSink.appendMessage(MessageSink.java:213) | 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:585) | at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:112) | at org.jboss.ejb3.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:166) | at biz.mbisoftware.common.ParameterInterceptor.parameters(ParameterInterceptor.java:43) | 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:585) | at org.jboss.ejb3.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:118) | at org.jboss.ejb3.interceptor.EJB3InterceptorsInterceptor.invoke(EJB3InterceptorsInterceptor.java:63) | at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101) | at org.jboss.ejb3.entity.TransactionScopedEntityManagerInterceptor.invoke(TransactionScopedEntityManagerInterceptor.java:54) | at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101) | at org.jboss.ejb3.AllowedOperationsInterceptor.invoke(AllowedOperationsInterceptor.java:47) | at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101) | at org.jboss.aspects.tx.TxPolicy.invokeInOurTx(TxPolicy.java:79) | ... 49 more | Using MbiMsgpa.PK as the ID-class instead of MbiMsgpt.PK for Entity MbiMsgpt solves the problem. Is this somewhere documented as the expected behaviour for this or may I call this a Bug? View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4084265#4084265 Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4084265 _______________________________________________ jboss-user mailing list jboss-user@lists.jboss.org https://lists.jboss.org/mailman/listinfo/jboss-user