[jboss-user] [EJB 3.0] - RC9: merge() fails with detached obj in 1:1 relationship

Juergen.Zimmermann do-not-reply at jboss.com
Mon Sep 25 07:05:26 EDT 2006


I'm invoking em.merge() with a detached object. The detached object has a 1:1 relationship with another detached object. The fetch strategy is unchanged. merge() fails and yields this stack trace:
javax.ejb.EJBException: java.lang.ClassCastException: de.hska.kundenverwaltung.db.Firmenkunde
  | at org.jboss.ejb3.tx.Ejb3TxPolicy.handleExceptionInOurTx(Ejb3TxPolicy.java:69)
  | at org.jboss.aspects.tx.TxPolicy.invokeInOurTx(TxPolicy.java:83)
  | at org.jboss.aspects.tx.TxInterceptor$Required.invoke(TxInterceptor.java:197)
  | at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
  | at org.jboss.aspects.tx.TxPropagationInterceptor.invoke(TxPropagationInterceptor.java:76)
  | 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.RoleBasedAuthorizationInterceptor.invoke(RoleBasedAuthorizationInterceptor.java:167)
  | at org.jboss.ejb3.security.RoleBasedAuthorizationInterceptor.invoke(RoleBasedAuthorizationInterceptor.java:108)
  | at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
  | at org.jboss.aspects.security.AuthenticationInterceptor.invoke(AuthenticationInterceptor.java:78)
  | at org.jboss.ejb3.security.Ejb3AuthenticationInterceptor.invoke(Ejb3AuthenticationInterceptor.java:131)
  | at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
  | at org.jboss.ejb3.ENCPropagationInterceptor.invoke(ENCPropagationInterceptor.java:47)
  | 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.dynamicInvoke(StatelessContainer.java:263)
  | at org.jboss.aop.Dispatcher.invoke(Dispatcher.java:106)
  | at org.jboss.aspects.remoting.AOPRemotingInvocationHandler.invoke(AOPRemotingInvocationHandler.java:82)
  | at org.jboss.remoting.ServerInvoker.invoke(ServerInvoker.java:828)
  | at org.jboss.remoting.ServerInvoker.invoke(ServerInvoker.java:681)
  | at org.jboss.remoting.transport.socket.ServerThread.processInvocation(ServerThread.java:358)
  | at org.jboss.remoting.transport.socket.ServerThread.dorun(ServerThread.java:412)
  | at org.jboss.remoting.transport.socket.ServerThread.run(ServerThread.java:239)
  | Caused by: java.lang.ClassCastException: de.hska.kundenverwaltung.db.Firmenkunde
  | at org.hibernate.type.LongType.set(LongType.java:42)
  | at org.hibernate.type.NullableType.nullSafeSet(NullableType.java:83)
  | at org.hibernate.type.NullableType.nullSafeSet(NullableType.java:65)
  | at org.hibernate.loader.Loader.bindPositionalParameters(Loader.java:1513)
  | at org.hibernate.loader.Loader.prepareQueryStatement(Loader.java:1575)
  | at org.hibernate.loader.Loader.doQuery(Loader.java:661)
  | at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:224)
  | at org.hibernate.loader.Loader.loadEntity(Loader.java:1784)
  | at org.hibernate.loader.entity.AbstractEntityLoader.load(AbstractEntityLoader.java:48)
  | at org.hibernate.loader.entity.EntityLoader.loadByUniqueKey(EntityLoader.java:85)
  | at org.hibernate.persister.entity.AbstractEntityPersister.loadByUniqueKey(AbstractEntityPersister.java:1581)
  | at org.hibernate.type.EntityType.loadByUniqueKey(EntityType.java:365)
  | at org.hibernate.type.EntityType.resolve(EntityType.java:306)
  | at org.hibernate.type.EntityType.replace(EntityType.java:207)
  | at org.hibernate.type.TypeFactory.replace(TypeFactory.java:437)
  | at org.hibernate.event.def.DefaultMergeEventListener.copyValues(DefaultMergeEventListener.java:340)
  | at org.hibernate.event.def.DefaultMergeEventListener.entityIsDetached(DefaultMergeEventListener.java:267)
  | at org.hibernate.event.def.DefaultMergeEventListener.onMerge(DefaultMergeEventListener.java:120)
  | at org.hibernate.event.def.DefaultMergeEventListener.onMerge(DefaultMergeEventListener.java:53)
  | at org.hibernate.impl.SessionImpl.fireMerge(SessionImpl.java:677)
  | at org.hibernate.impl.SessionImpl.merge(SessionImpl.java:661)
  | at org.hibernate.impl.SessionImpl.merge(SessionImpl.java:665)
  | at org.hibernate.ejb.AbstractEntityManagerImpl.merge(AbstractEntityManagerImpl.java:227)
  | at org.jboss.ejb3.entity.TransactionScopedEntityManager.merge(TransactionScopedEntityManager.java:181)


View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3973847#3973847

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3973847



More information about the jboss-user mailing list