ma.glasnost.orika.MappingException

There are no available Samebug tips for this exception. Do you have an idea how to solve this issue? A short tip would help users who saw this issue last week.

  • Orika - map Page<T> to Page<TDto>
    via Stack Overflow by kbysiec
    ,
  • exception while saving tags
    via GitHub by damithc
    ,
  • chronicle queue serialising throwables
    via Stack Overflow by Dan
    ,
  • Cat cat = new Cat(); cat.setId( new CatPk() ); cat.getId().setName( "titi" ); cat.getId().setThoroughbred( "unknown" ); Set<Woman> women = new HashSet<Woman>(); Woman woman = new Woman(); woman.setId( new WomanPk() ); woman.getId().setFirstName( "Lady" ); woman.getId().setLastName( "McBeth" ); women.add( woman ); cat.setHumanContacts( Collections.unmodifiableSet( women ) ); Set<Cat> cats = new HashSet<Cat>(); cats.add( cat ); woman.setCats( Collections.unmodifiableSet(cats) ); s.persist( cat ); s.persist( woman ); tx.commit(); s.merge( woman ); During merge, the entity is copied into itself (?) defaultmergeeventlistener.entityIsPersistent() => copyValues(persister, entity, entity, source, copyCache); java.lang.UnsupportedOperationException at java.util.Collections$UnmodifiableCollection.clear(Collections.java:1037) at org.hibernate.collection.PersistentSet.clear(PersistentSet.java:247) at org.hibernate.type.CollectionType.replaceElements(CollectionType.java:404) at org.hibernate.type.CollectionType.replace(CollectionType.java:449) at org.hibernate.type.TypeFactory.replace(TypeFactory.java:437) at org.hibernate.event.def.DefaultMergeEventListener.copyValues(DefaultMergeEventListener.java:282) at org.hibernate.event.def.DefaultMergeEventListener.entityIsPersistent(DefaultMergeEventListener.java:132) at org.hibernate.event.def.DefaultMergeEventListener.onMerge(DefaultMergeEventListener.java:105) at org.hibernate.event.def.DefaultMergeEventListener.onMerge(DefaultMergeEventListener.java:51) 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.test.annotations.manytomany.ManyToManyTest.testUnmodifiableCollection(ManyToManyTest.java:102) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at org.hibernate.test.annotations.TestCase.runTest(TestCase.java:67) at com.intellij.rt.execution.junit2.JUnitStarter.main(JUnitStarter.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 com.intellij.rt.execution.application.AppMain.main(AppMain.java:90) What is the reason for that? The spec says that "If X is a managed entity, it is ignored by the merge operation"
    via by Emmanuel Bernard,
  • Cat cat = new Cat(); cat.setId( new CatPk() ); cat.getId().setName( "titi" ); cat.getId().setThoroughbred( "unknown" ); Set<Woman> women = new HashSet<Woman>(); Woman woman = new Woman(); woman.setId( new WomanPk() ); woman.getId().setFirstName( "Lady" ); woman.getId().setLastName( "McBeth" ); women.add( woman ); cat.setHumanContacts( Collections.unmodifiableSet( women ) ); Set<Cat> cats = new HashSet<Cat>(); cats.add( cat ); woman.setCats( Collections.unmodifiableSet(cats) ); s.persist( cat ); s.persist( woman ); tx.commit(); s.merge( woman ); During merge, the entity is copied into itself (?) defaultmergeeventlistener.entityIsPersistent() => copyValues(persister, entity, entity, source, copyCache); java.lang.UnsupportedOperationException at java.util.Collections$UnmodifiableCollection.clear(Collections.java:1037) at org.hibernate.collection.PersistentSet.clear(PersistentSet.java:247) at org.hibernate.type.CollectionType.replaceElements(CollectionType.java:404) at org.hibernate.type.CollectionType.replace(CollectionType.java:449) at org.hibernate.type.TypeFactory.replace(TypeFactory.java:437) at org.hibernate.event.def.DefaultMergeEventListener.copyValues(DefaultMergeEventListener.java:282) at org.hibernate.event.def.DefaultMergeEventListener.entityIsPersistent(DefaultMergeEventListener.java:132) at org.hibernate.event.def.DefaultMergeEventListener.onMerge(DefaultMergeEventListener.java:105) at org.hibernate.event.def.DefaultMergeEventListener.onMerge(DefaultMergeEventListener.java:51) 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.test.annotations.manytomany.ManyToManyTest.testUnmodifiableCollection(ManyToManyTest.java:102) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at org.hibernate.test.annotations.TestCase.runTest(TestCase.java:67) at com.intellij.rt.execution.junit2.JUnitStarter.main(JUnitStarter.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 com.intellij.rt.execution.application.AppMain.main(AppMain.java:90) What is the reason for that? The spec says that "If X is a managed entity, it is ignored by the merge operation"
    via by Emmanuel Bernard,
  • GitHub comment 19#159358846
    via GitHub by ewencp
    ,
  • Warlock's Thoughts: JPA and unmodifiable collections
    via by Unknown author,
    • ma.glasnost.orika.MappingException: While attempting the following mapping: sourceClass = class org.springframework.data.domain.PageImpl sourceType = org.springframework.data.domain.Page<Entry> destinationType = org.springframework.data.domain.Page<EntryDto> resolvedStrategy = InstantiateAndUseCustomMapperStrategy<PageImpl<Entry>, PageImpl<EntryDto>> {customMapper: GeneratedMapper<PageImpl<Entry>, PageImpl<EntryDto>> {usedConverters: [], usedMappers: [], usedMapperFacades: [DefaultBoundMapperFacade<Sort, Sort>], usedTypes: [Object] }, unenhancer: ma.glasnost.orika.unenhance.BaseUnenhancer@4b5aa48b, objectFactory: ma.glasnost.orika.generated.PageImpl_PageImpl_ObjectFactory59678627946495970211838179$3@2dd2ff87} Error occurred: java.lang.UnsupportedOperationException -----begin dump of current state----------------------------- Registered object factories: 3 (approximate size: 9,541.1 kB) [AccountDto] : {Account=DefaultConstructorObjectFactory<AccountDto>} [PageImpl<EntryDto>] : {PageImpl<Entry>=ma.glasnost.orika.generated.PageImpl_PageImpl_ObjectFactory59678627946495970211838179$3@2dd2ff87} [EntryDto] : {Entry=DefaultConstructorObjectFactory<EntryDto>} ------------------------------------------------------------- Registered mappers: 3 (approximate size: 9,794.2 kB) [0] : GeneratedMapper<PageImpl<Entry>, PageImpl<EntryDto>> {usedConverters: [], usedMappers: [], usedMapperFacades: [DefaultBoundMapperFacade<Sort, Sort>], usedTypes: [Object] } [1] : GeneratedMapper<Entry, EntryDto> {usedConverters: [builtin:CloneableConverter(Copy by cloning:Date, Calendar, XMLGregorianCalendar)], usedMappers: [], usedMapperFacades: [DefaultBoundMapperFacade<Account, AccountDto>], usedTypes: [Date] } [2] : GeneratedMapper<Account, AccountDto> {usedConverters: [builtin:CloneableConverter(Copy by cloning:Date, Calendar, XMLGregorianCalendar)], usedMappers: [], usedMapperFacades: [], usedTypes: [Date, Entry, EntryDto] } ------------------------------------------------------------- Registered concrete types: 6 (approximate size: 346.9 kB) [interface java.util.Collection] : ArrayList<Object> [interface java.util.Map] : LinkedHashMap<Object, Object> [interface java.util.Map$Entry] : MapEntry<Object, Object> [Page<Entry>] : PageImpl<EntryDto> [interface java.util.List] : ArrayList<Object> [interface java.util.Set] : LinkedHashSet<Object> ------------------------------------------------------------- Resolved strategies: 4 (approximate size: 9,794.6 kB) {source: PageImpl, dest: Page<EntryDto>, in-place:false}: InstantiateAndUseCustomMapperStrategy<PageImpl<Entry>, PageImpl<EntryDto>> {customMapper: GeneratedMapper<PageImpl<Entry>, PageImpl<EntryDto>> {usedConverters: [], usedMappers: [], usedMapperFacades: [DefaultBoundMapperFacade<Sort, Sort>], usedTypes: [Object] }, unenhancer: ma.glasnost.orika.unenhance.BaseUnenhancer@4b5aa48b, objectFactory: ma.glasnost.orika.generated.PageImpl_PageImpl_ObjectFactory59678627946495970211838179$3@2dd2ff87} {source: Account, dest: AccountDto, in-place:false}: InstantiateAndUseCustomMapperStrategy<Account, AccountDto> {customMapper: GeneratedMapper<Account, AccountDto> {usedConverters: [builtin:CloneableConverter(Copy by cloning:Date, Calendar, XMLGregorianCalendar)], usedMappers: [], usedMapperFacades: [], usedTypes: [Date, Entry, EntryDto] }, unenhancer: ma.glasnost.orika.unenhance.BaseUnenhancer@4b5aa48b, objectFactory: DefaultConstructorObjectFactory<AccountDto>} {source: Entry, dest: Object, in-place:false}: InstantiateAndUseCustomMapperStrategy<Entry, EntryDto> {customMapper: GeneratedMapper<Entry, EntryDto> {usedConverters: [builtin:CloneableConverter(Copy by cloning:Date, Calendar, XMLGregorianCalendar)], usedMappers: [], usedMapperFacades: [DefaultBoundMapperFacade<Account, AccountDto>], usedTypes: [Date] }, unenhancer: ma.glasnost.orika.unenhance.BaseUnenhancer@4b5aa48b, objectFactory: DefaultConstructorObjectFactory<EntryDto>} {source: Entry, dest: EntryDto, in-place:false}: InstantiateAndUseCustomMapperStrategy<Entry, EntryDto> {customMapper: GeneratedMapper<Entry, EntryDto> {usedConverters: [builtin:CloneableConverter(Copy by cloning:Date, Calendar, XMLGregorianCalendar)], usedMappers: [], usedMapperFacades: [DefaultBoundMapperFacade<Account, AccountDto>], usedTypes: [Date] }, unenhancer: ma.glasnost.orika.unenhance.BaseUnenhancer@4b5aa48b, objectFactory: DefaultConstructorObjectFactory<EntryDto>} ------------------------------------------------------------- Unenhance strategy: ma.glasnost.orika.unenhance.BaseUnenhancer@4b5aa48b -----end dump of current state------------------------------- at ma.glasnost.orika.impl.ExceptionUtility.newMappingException(ExceptionUtility.java:55) at ma.glasnost.orika.impl.MapperFacadeImpl.map(MapperFacadeImpl.java:280) at ma.glasnost.orika.impl.MapperFacadeImpl.map(MapperFacadeImpl.java:243) at ma.glasnost.orika.impl.MapperFacadeImpl.map(MapperFacadeImpl.java:133) at com.agileplayers.agilemanager.AgileManagerApplication.start(AgileManagerApplication.java:49) at com.agileplayers.agilemanager.AgileManagerApplication.main(AgileManagerApplication.java:34) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at com.intellij.rt.execution.application.AppMain.main(AppMain.java:144) Caused by: java.lang.UnsupportedOperationException at java.util.Collections$UnmodifiableCollection.clear(Collections.java:1074) at ma.glasnost.orika.generated.Orika_PageImpl_PageImpl_Mapper5970055563717$0.mapAtoB(Orika_PageImpl_PageImpl_Mapper5970055563717$0.java) at ma.glasnost.orika.impl.mapping.strategy.UseCustomMapperStrategy.map(UseCustomMapperStrategy.java:67) at ma.glasnost.orika.impl.MapperFacadeImpl.map(MapperFacadeImpl.java:266) ... 9 more
    No Bugmate found.