I am getting this exception sporadically when I’m running-related API with K6 load testing with multiple users
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.GeneratedMethodAccessor695.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at se.test.nova.proxy.impl.TransactionInvocationHandler.invokeMethodOnWrappedObject(TransactionInvocationHandler.java:63)
... 72 more
Caused by: org.hibernate.HibernateException: Found shared references to a collection: se.test.platform.cc.unit.impl.PatientImpl.addresses
at org.hibernate.engine.internal.Collections.processReachableCollection(Collections.java:187)
at org.hibernate.event.internal.FlushVisitor.processCollection(FlushVisitor.java:49)
at org.hibernate.event.internal.AbstractVisitor.processValue(AbstractVisitor.java:104)
at org.hibernate.event.internal.AbstractVisitor.processValue(AbstractVisitor.java:65)
at org.hibernate.event.internal.AbstractVisitor.processEntityPropertyValues(AbstractVisitor.java:59)
at org.hibernate.event.internal.DefaultFlushEntityEventListener.onFlushEntity(DefaultFlushEntityEventListener.java:179)
at org.hibernate.event.internal.AbstractFlushingEventListener.flushEntities(AbstractFlushingEventListener.java:235)
at org.hibernate.event.internal.AbstractFlushingEventListener.flushEverythingToExecutions(AbstractFlushingEventListener.java:94)
at org.hibernate.event.internal.DefaultDirtyCheckEventListener.onDirtyCheck(DefaultDirtyCheckEventListener.java:35)
at org.hibernate.internal.SessionImpl.isDirty(SessionImpl.java:1449)
at se.test.platform.sdk.server.entity.dto.mapper.spi.AbstractMapper.enterFlush(AbstractMapper.java:106)
at se.test.platform.sdk.server.entity.dto.mapper.spi.AbstractDTOMapper.convert(AbstractDTOMapper.java:36)
at se.test.fluidbalance.common.util.FluidSubstanceCollectionDTOBuilder.build(FluidSubstanceCollectionDTOBuilder.java:67)
at se.test.fluidbalance.service.impl.FluidSubstanceServiceImpl.findRegisteredFluidSubstanceCollection(FluidSubstanceServiceImpl.java:67)
Usually this means that there are multiple “managed collections” around pointing to the same collection key. IMO this can only happen if your @ManyToOne uses some kind of @JoinColumn that refers to a non-unique column of PatientImpl. Can you show the full mapping? Also, some more debugging would be needed if my assumption is wrong. Can you put a breakpoint where the exception is thrown and try to find out how the two collection instances are reachable?
Hi beikov, Thanks for the quick response. I could not find a mapping @ManyToOne that uses a @JoinColumn with a non-unique column in PatientImpl. This the full mapping of classes