0
votes

My database contains three tables ‘Person’ , ‘LegalPerson’ and ‘RealPerson’. in my code ‘LegalPerson’ and ‘RealPerson’ classes are driven from ‘Peron’ class the Entity Relationship diagram between these three entities is as following picture: enter image description here

i use SubClassMap for both 'RealPerson' and 'LegalPerson' mappings. the problem is when i try to save for example a 'LegalPerson' object with Person_Id that is already saved in 'Person' table, i get the following exception: An unhandled exception of type 'NHibernate.StaleObjectStateException' occurred in NHibernate.dll

Additional information: Row was updated or deleted by another transaction (or unsaved-value mapping was incorrect)

1

1 Answers

0
votes

I solved the problem. Saving any object of type 'RealPerson' or 'LegalPerson' will save an entry implicitly in 'Person' table as well as in 'RealPerson' or 'LegalPerson'.