Add a "try" possibility to unsaved-value for SaveOrUpdate with assigned Guid

Description

I know the question has been asked many times but it seems to make sense:

We often have to replicate data between different systems where we want to keep the original guids of the data. when wanting to do so using Nhibernate, we cannot use the SaveOrUpdate possibility since there is only the option of:

always save
Always update
save when id = null
save when id = null or "value"

So basically, if you want to use SaveOrUpdate, you cannot assign your own guid's as primary keys.

In data replication situations (for example receiving data from another application using a messagequeue) you have to first check if an object is already present and then decide to save or update.

It would be nice to have an option saying "try" which would do this for you (so query the database/persistence to see if an object with the given id already exists, if not= save, else = update)

Environment

None

Activity

Show:

Alex Zaytsev May 18, 2017 at 11:57 PM

Details

Assignee

Reporter

Components

Affects versions

Priority

Who's Looking?

Open Who's Looking?

Created November 13, 2009 at 8:46 AM
Updated May 18, 2017 at 11:57 PM
Who's Looking?