views:

840

answers:

1

Hi,

Can I map the identity of an entity to a column whose values are not auto-generated (but still unique)?

If so, what should I put in the xml identity/generator tag?

Thanks.

+1  A: 

It depends on how new identity values are created. My guess here would be to use if you are giving the values to new rows manually (before they are saved). FYI -- if you use the assigned generator:

Due to its inherent nature, entities that use this generator cannot be saved via the ISession's SaveOrUpdate() method. Instead you have to explicitly specify to NHibernate if the object should be saved or updated by calling either the Save() or Update() method of the ISession.

Generator Documentation

Watson

related questions