Save(potential Mate); // in a higher tier of the application cat.
Hibernate - save Or Update problem Hy, I'm using Hibernate 2.1.6 and Spring 1.1.0.Load(typeof(Cat), cat ID); // in a higher tier of the application Cat mate = new Cat(); cat.Mate = mate; // later, in a new session second Session.The methods look like same and difficult to differentiate between them if you are not understanding them clearly.If you understand the hibernate mechanism clearly, it doesn’t execute the SQL statements directly to manipulate the database, hibernate itself a state maintaining mechanism. The Update Order message contains a complete order.The normal scenario here is that the backend translate the order contained in the message to a domain model that is then persisted to the database via NHibernate.Why won’t the missing order line be deleted from the db?Well consider this normal update scenario: Here the order line is removed on the instance that is already attached to an open NHiberante session.Many applications need to retrieve an object in one transaction, send it to the UI layer for manipulation, then save the changes in a new transaction.(Applications that use this kind of approach in a high-concurrency environment usually use versioned data to ensure transaction isolation.) This approach requires a slightly different programming model to the one described in the last section.