Probably your id has an initial value other than the default (0 for int, etc), so NHibernate thinks it already comes from the DB.
On Sep 26, 8:20 am, mynkow <[email protected]> wrote: > Hi Oskar, > > I do not have OneToMany relationship to mark as inverse. here are the > mappings. > > public void TestCode() > { > Session.Delete(notificationObjectForDelete); > > Session.Delete(mainNotificationObjectForDelete); > > // If the lines below are not executed I got Deletes into the database. > > // If the lines below are executed I got updates statements. > var notification = Session.Get<Notification>(someOtherId); var > newMailNotificationObject = new MainNotification(notification); > Session.Save(newMailNotificationObject); } > > public class NotificationMap : ClassMap<Notification> > { > public NotificationMap() > { > Table("notifications"); > > Id(n => n.Id, "notification_id"); > References<NotificationTemplate>(n => n.NotificationTemplate, > "notification_template_id"); > DiscriminateSubClassesOnColumn("notification_type"); > } > } > > public class MailNotificationMap : ClassMap<MailNotification<INotification>> > { > public MailNotificationMap() > { > Table("email_notifications"); > > Id(n => n.Id, "email_notification_id"); > References<Notification>(n => n.Notification, "notification_id"); > } > } > > <https://lh5.googleusercontent.com/-kOZjQU8RWsI/ToAndFQoBNI/AAAAAAAAAZ...> -- You received this message because you are subscribed to the Google Groups "nhusers" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/nhusers?hl=en.
