Hi,
I realize an equivalent topic to what I will ask has already been created here
http://forum.hibernate.org/viewtopic.ph ... texception
I also found some links this has perhaps been addressed, but this is in the context of JIRA so I do not understand whether this was addressed in JIRA or Hibernate:
http://jira.codehaus.org/browse/XPR-93; ... ge=history
Having said that, here is my problem - it is in data where other applications can remove parent from parent-child without nullifying the child foreign key, I cannot control that.
1) If parent row is deleted without nullifying child forein key to parent table (or deleting the child row), accessing the child causes exception:
Caused by: org.hibernate.UnresolvableObjectException: No row with the given identifier exists: [com.acompany.notifications.RecipientVO#34079]
at org.hibernate.UnresolvableObjectException.throwIfNull(UnresolvableObjectException.java:42)
at org.hibernate.impl.SessionImpl.internalLoad(SessionImpl.java:601)
2) In the hbm.xml, there is many-to-one defined
<many-to-one name="recipient" class="com.acompany.notifications.RecipientVO" column="ALRUS2MG_USERS_KEY" />
3) I realize this situation does represent "broken mapping".
My Question) I wonder if there is any way in the hbm.xml to define the parent "optional" in the mapping.
As a note, I thought lazy=false may help but there is an unrelated issue with it in the context of this application.
Thanks Milan