I get this message when I try to insert the second class (child).
But the Id of the Child is a foreign key to the Parent Id, then the Id need to be the same and when I try to insert I receive this:
NHibernate.ADOException: Could not save object ---> NHibernate.HibernateException: The generated identifier is already in use: [SisImob.Database.ClienteEndereco#28] at NHibernate.Impl.SessionImpl.DoSave(Object obj, Object id, IClassPersister persister, Boolean useIdentityColumn, CascadingAction cascadeAction, Object anything) at NHibernate.Impl.SessionImpl.SaveWithGeneratedIdentifier(Object obj, CascadingAction action, Object anything) --- End of inner exception stack trace --- at NHibernate.Impl.SessionImpl.SaveWithGeneratedIdentifier(Object obj, CascadingAction action, Object anything) at NHibernate.Impl.SessionImpl.Save(Object obj) at SisImob.Database.Services.WsCliente.InserirClienteFisico(Cliente cl, ClienteFisico cf, ClienteConjuge cj, ClienteEndereco cend) in E:\Projetos\VisualC#\SisImob\SisImob\Services\WsCliente.cs:line 34
Anyone has one idea?
|