I Had Assigned The Value To The Parent's Child Object Id as
Student studentObj=new Student();
StudentDAO daoStudent=new StudentDAO();
studentObj=daoStudent.LoadById(studentBE.StudentId);
studentObj.Address.AddressId=studentBE.AddressId;
Then I Had Got The Exception "Identifier Of An Instance Of Address Was Altered From 5 to 4".
An NHibernateException.
Solution:-
-----------
By Creating A New Object Of Address With The Given Id And Replacing The Address Object Associated With Object Student -- as below:
studentObj.Address=new Address(){AddressId=studentBE.AddressId};
Student studentObj=new Student();
StudentDAO daoStudent=new StudentDAO();
studentObj=daoStudent.LoadById(studentBE.StudentId);
studentObj.Address.AddressId=studentBE.AddressId;
Then I Had Got The Exception "Identifier Of An Instance Of Address Was Altered From 5 to 4".
An NHibernateException.
Solution:-
-----------
By Creating A New Object Of Address With The Given Id And Replacing The Address Object Associated With Object Student -- as below:
studentObj.Address=new Address(){AddressId=studentBE.AddressId};
Please let me know the complete solution and i did not catch your concept properly. So,Please update me the complete solution.
ReplyDelete