Hi...
I'm getting this exception, and I know I'm doing something wrong but don't
know what.
Caused by: Exception [TOPLINK-200] (Oracle TopLink Essentials - 2.0 (Build
b54-rc (07/03/2007))):
oracle.toplink.essentials.exceptions.DescriptorException
Exception Description: Attempt to register an object with dead indirection
as a new object. Possibly the object was deleted or removed from the cache
during a merge of a serialized clone. This is a concurrency violation,
consider a locking strategy.
Mapping: oracle.toplink.essentials.mappings.OneToManyMapping
[servicesOfferedCollection]
Descriptor: RelationalDescriptor(
com.playground.concierge.model.entity.ServiceType -->
[DatabaseTable(service_types)])
at
oracle.toplink.essentials.exceptions.DescriptorException.attemptToRegisterDeadIndirection
(DescriptorException.java:278)
at
oracle.toplink.essentials.internal.indirection.TransparentIndirectionPolicy.cloneAttribute
(TransparentIndirectionPolicy.java:146)
at
oracle.toplink.essentials.mappings.ForeignReferenceMapping.buildClone(
ForeignReferenceMapping.java:133)
at
oracle.toplink.essentials.internal.descriptors.ObjectBuilder.populateAttributesForClone
(ObjectBuilder.java:2174)
at
oracle.toplink.essentials.internal.sessions.UnitOfWorkImpl.cloneAndRegisterNewObject
(UnitOfWorkImpl.java:632)
at
oracle.toplink.essentials.internal.sessions.UnitOfWorkImpl.internalRegisterObject
(UnitOfWorkImpl.java:2255)
at
oracle.toplink.essentials.internal.sessions.MergeManager.registerObjectForMergeCloneIntoWorkingCopy
(MergeManager.java:697)
at
oracle.toplink.essentials.internal.sessions.MergeManager.mergeChangesOfCloneIntoWorkingCopy
(MergeManager.java:411)
at
oracle.toplink.essentials.internal.sessions.MergeManager.mergeChanges(
MergeManager.java:264)
at
oracle.toplink.essentials.internal.sessions.UnitOfWorkImpl.mergeCloneWithReferences
(UnitOfWorkImpl.java:2723)
at
oracle.toplink.essentials.internal.ejb.cmp3.base.RepeatableWriteUnitOfWork.mergeCloneWithReferences
(RepeatableWriteUnitOfWork.java:219)
at
oracle.toplink.essentials.internal.ejb.cmp3.base.EntityManagerImpl.mergeInternal
(EntityManagerImpl.java:235)
at
oracle.toplink.essentials.internal.ejb.cmp3.EntityManagerImpl.merge(
EntityManagerImpl.java:128)
at com.sun.enterprise.util.EntityManagerWrapper.merge(
EntityManagerWrapper.java:256)
at com.playground.concierge.model.facade.ServiceTypeFacade.edit(
ServiceTypeFacade.java:32)
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:597)
at
com.sun.enterprise.security.application.EJBSecurityManager.runMethod(
EJBSecurityManager.java:1067)
at com.sun.enterprise.security.SecurityUtil.invoke(SecurityUtil.java
:176)
at com.sun.ejb.containers.BaseContainer.invokeTargetBeanMethod(
BaseContainer.java:2884)
at com.sun.ejb.containers.BaseContainer.intercept(BaseContainer.java
:3975)
at com.sun.ejb.containers.EJBObjectInvocationHandler.invoke(
EJBObjectInvocationHandler.java:203)
... 17 more
The relevant code happens inside an EJB:
@PersistenceContext()
private EntityManager em;
public void edit(ServiceType entity) {
em.merge(entity);
}
And ServiceType look like this (I took some stuff, i.e. get/set methods, out
for convenience):
@Entity()
@Table(name = "service_types")
public class ServiceType
implements Serializable {
@Id()
@Column(name = "type", nullable = false)
private String type;
@OneToMany(cascade = CascadeType.ALL, mappedBy = "serviceType")
private Collection<ServicesOffered> servicesOfferedCollection;
...
}
Any help?
thanks,
Daniel.