Hibernate version: v1.2.0GA
Hi,
@ the mo I have the following guard clause on my Retrieve by Id method (TPersistableObject & TId are generic params):
Code:
public TPersistableObject TryToGetById(TId id)
{
#region Guards
if (id.Equals(default(TId))) return null;
#endregion
return Session.Get<TPersistableObject>(id);
}
This works fine when the unsaved-value of the identifier is indeed default(TId). However I am now dealing with a legacy database that has some entities that have an unsaved-value that is not default(TId)
...Is there any way that I can return the unsaved value of an identifier for an entity.
N.B. I had originally intended on using the EntityMetamodel property of the AbstractEntityPersister but alas it is a protected property so I can't get access to it.