I have a pretty complex structure of entities (which is why I'm not listing them all here). But the thing is that I have a @MappedSuperclass called PatentBO which has a subclass SwissPatentBO. The PatentBO contains the following object:
Code:
@OneToOne(fetch = FetchType.EAGER, cascade = CascadeType.ALL)
@JoinColumn(name = "PAT_PRIORITY_GROUP_ID")
private PatPriorities priorities;
The ID in PatPriorities looks like this:
Code:
@Id
@Column(name = "PAT_PRIORITY_GROUP_ID")
@SequenceGenerator(name = ID_GENERATOR_NAME, sequenceName = "SEQ_PAT_PRIORITY_GROUP_ID", allocationSize = 1, initialValue = 1)
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = ID_GENERATOR_NAME)
private Integer id;
I can insert the whole entity tree without problem, but if I try to update it, I get the following error (showing only the last part of the stacktrace):
Code:
...
Caused by: org.hibernate.PropertyAccessException: could not get a field value by reflection getter of ch.ipi.esv.ip.bo.pat.PatPriorities.id
at org.hibernate.property.DirectPropertyAccessor$DirectGetter.get(DirectPropertyAccessor.java:58)
at org.hibernate.tuple.entity.AbstractEntityTuplizer.getIdentifier(AbstractEntityTuplizer.java:206)
at org.hibernate.persister.entity.AbstractEntityPersister.getIdentifier(AbstractEntityPersister.java:3619)
at org.hibernate.persister.entity.AbstractEntityPersister.isTransient(AbstractEntityPersister.java:3335)
at org.hibernate.engine.ForeignKeys.isTransient(ForeignKeys.java:204)
at org.hibernate.engine.CascadingAction$9.noCascade(CascadingAction.java:371)
at org.hibernate.engine.Cascade.cascade(Cascade.java:162)
at org.hibernate.event.def.AbstractFlushingEventListener.cascadeOnFlush(AbstractFlushingEventListener.java:154)
at org.hibernate.event.def.AbstractFlushingEventListener.prepareEntityFlushes(AbstractFlushingEventListener.java:145)
at org.hibernate.event.def.AbstractFlushingEventListener.flushEverythingToExecutions(AbstractFlushingEventListener.java:88)
at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:49)
at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1027)
at org.hibernate.ejb.AbstractEntityManagerImpl.flush(AbstractEntityManagerImpl.java:304)
... 24 more
Caused by: java.lang.IllegalArgumentException: Can not set java.lang.Integer field ch.ipi.esv.ip.bo.pat.PatPriorities.id to ch.ipi.esv.ip.bo.pat.chp.SwissPatentBO
at sun.reflect.UnsafeFieldAccessorImpl.throwSetIllegalArgumentException(UnsafeFieldAccessorImpl.java:146)
at sun.reflect.UnsafeFieldAccessorImpl.throwSetIllegalArgumentException(UnsafeFieldAccessorImpl.java:150)
at sun.reflect.UnsafeFieldAccessorImpl.ensureObj(UnsafeFieldAccessorImpl.java:37)
at sun.reflect.UnsafeObjectFieldAccessorImpl.get(UnsafeObjectFieldAccessorImpl.java:18)
at java.lang.reflect.Field.get(Field.java:358)
at org.hibernate.property.DirectPropertyAccessor$DirectGetter.get(DirectPropertyAccessor.java:55)
... 36 more
The explanations I found by googling seemed non-related to my problem.
However, from the error message, I don't understand what I could be doing wrong, especially since I can insert the same without problem.
Any hint is be greatly appreciated!
Best regards,
Eric