You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
During deletion of rejected studies an exception is thrown:
2023-04-28 15:46:12,462 INFO [org.dcm4chee.arc.iocm.rs.StudyMgtRS] (default task-2) Response Internal Server Error caused by javax.ejb.EJBException: java.lang.IllegalArgumentException: Removing a detached instance org.dcm4chee.arc.entity.UIDMap#21
at [email protected]//org.jboss.as.ejb3.tx.CMTTxInterceptor.invokeInOurTx(CMTTxInterceptor.java:268)
at [email protected]//org.jboss.as.ejb3.tx.CMTTxInterceptor.requiresNew(CMTTxInterceptor.java:408)
at [email protected]//org.jboss.as.ejb3.tx.CMTTxInterceptor.processInvocation(CMTTxInterceptor.java:162)
at [email protected]//org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:422)
at [email protected]//org.jboss.invocation.InterceptorContext$Invocation.proceed(InterceptorContext.java:509)
(...)
Caused by: java.lang.IllegalArgumentException: Removing a detached instance org.dcm4chee.arc.entity.UIDMap#21
at [email protected]//org.hibernate.event.internal.DefaultDeleteEventListener.disallowDeletionOfDetached(DefaultDeleteEventListener.java:196)
at [email protected]//org.hibernate.event.internal.DefaultDeleteEventListener.performDetachedEntityDeletionCheck(DefaultDeleteEventListener.java:184)
at [email protected]//org.hibernate.event.internal.DefaultDeleteEventListener.onDelete(DefaultDeleteEventListener.java:105)
at [email protected]//org.hibernate.event.internal.DefaultDeleteEventListener.onDelete(DefaultDeleteEventListener.java:72)
at [email protected]//org.hibernate.internal.SessionImpl.fireDelete(SessionImpl.java:1015)
at [email protected]//org.hibernate.internal.SessionImpl.delete(SessionImpl.java:951)
at [email protected]//org.hibernate.internal.SessionImpl.remove(SessionImpl.java:3461)
at [email protected]//org.jboss.as.jpa.container.AbstractEntityManager.remove(AbstractEntityManager.java:658)
at deployment.dcm4chee-arc-ear.ear.dcm4chee-arc-store.jar//org.dcm4chee.arc.store.impl.StoreServiceEJB.removeOrphaned(StoreServiceEJB.java:699)
at jdk.internal.reflect.GeneratedMethodAccessor175.invoke(Unknown Source)
To Reproduce
Steps to reproduce the behavior:
Try permanently delete rejected study.
Expected behavior
I expected deletion of study.
Desktop (please complete the following information):
OS: Windows
Browser: Firefox
Version: 112
Additional context
N/A
Proposed solution
In file "org/dcm4chee/arc/store/impl/StoreServiceEJB.java" I suggest to add em.merge() in the method:
@TransactionAttribute(TransactionAttributeType.REQUIRES_NEW)
public void removeOrphaned(UIDMap uidMap) {
if (countLocationsByUIDMap(uidMap) == 0)
em.remove(uidMap);
}
to attach uidMap to current hibernate session.
After change:
@TransactionAttribute(TransactionAttributeType.REQUIRES_NEW)
public void removeOrphaned(UIDMap uidMap) {
if (countLocationsByUIDMap(uidMap) == 0)
em.remove(em.merge(uidMap));
}
In #4036 there was problem with detached org.dcm4chee.arc.entity.Location, but this issue is for org.dcm4chee.arc.entity.UIDMap.
In commit 6c3efb0 these were 2 methods changed removeOrMarkLocationAs and removeOrphaned, but later only removeOrMarkLocationAs was fixed.
This discussion was converted from issue #4055 on May 10, 2023 07:18.
Heading
Bold
Italic
Quote
Code
Link
Numbered list
Unordered list
Task list
Attach files
Mention
Reference
Menu
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Describe the bug
During deletion of rejected studies an exception is thrown:
2023-04-28 15:46:12,462 INFO [org.dcm4chee.arc.iocm.rs.StudyMgtRS] (default task-2) Response Internal Server Error caused by javax.ejb.EJBException: java.lang.IllegalArgumentException: Removing a detached instance org.dcm4chee.arc.entity.UIDMap#21
at [email protected]//org.jboss.as.ejb3.tx.CMTTxInterceptor.invokeInOurTx(CMTTxInterceptor.java:268)
at [email protected]//org.jboss.as.ejb3.tx.CMTTxInterceptor.requiresNew(CMTTxInterceptor.java:408)
at [email protected]//org.jboss.as.ejb3.tx.CMTTxInterceptor.processInvocation(CMTTxInterceptor.java:162)
at [email protected]//org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:422)
at [email protected]//org.jboss.invocation.InterceptorContext$Invocation.proceed(InterceptorContext.java:509)
(...)
Caused by: java.lang.IllegalArgumentException: Removing a detached instance org.dcm4chee.arc.entity.UIDMap#21
at [email protected]//org.hibernate.event.internal.DefaultDeleteEventListener.disallowDeletionOfDetached(DefaultDeleteEventListener.java:196)
at [email protected]//org.hibernate.event.internal.DefaultDeleteEventListener.performDetachedEntityDeletionCheck(DefaultDeleteEventListener.java:184)
at [email protected]//org.hibernate.event.internal.DefaultDeleteEventListener.onDelete(DefaultDeleteEventListener.java:105)
at [email protected]//org.hibernate.event.internal.DefaultDeleteEventListener.onDelete(DefaultDeleteEventListener.java:72)
at [email protected]//org.hibernate.internal.SessionImpl.fireDelete(SessionImpl.java:1015)
at [email protected]//org.hibernate.internal.SessionImpl.delete(SessionImpl.java:951)
at [email protected]//org.hibernate.internal.SessionImpl.remove(SessionImpl.java:3461)
at [email protected]//org.jboss.as.jpa.container.AbstractEntityManager.remove(AbstractEntityManager.java:658)
at deployment.dcm4chee-arc-ear.ear.dcm4chee-arc-store.jar//org.dcm4chee.arc.store.impl.StoreServiceEJB.removeOrphaned(StoreServiceEJB.java:699)
at jdk.internal.reflect.GeneratedMethodAccessor175.invoke(Unknown Source)
To Reproduce
Steps to reproduce the behavior:
Try permanently delete rejected study.
Expected behavior
I expected deletion of study.
Desktop (please complete the following information):
Additional context
N/A
Proposed solution
In file "org/dcm4chee/arc/store/impl/StoreServiceEJB.java" I suggest to add em.merge() in the method:
@TransactionAttribute(TransactionAttributeType.REQUIRES_NEW)
public void removeOrphaned(UIDMap uidMap) {
if (countLocationsByUIDMap(uidMap) == 0)
em.remove(uidMap);
}
to attach uidMap to current hibernate session.
After change:
@TransactionAttribute(TransactionAttributeType.REQUIRES_NEW)
public void removeOrphaned(UIDMap uidMap) {
if (countLocationsByUIDMap(uidMap) == 0)
em.remove(em.merge(uidMap));
}
Beta Was this translation helpful? Give feedback.
All reactions