We use NHibernate as our server side ORM.
Sometimes it becomes necessary to remove an object from the database, considering only the type and identifier of this object. In addition, the deleted object was not previously loaded (therefore, it is not in the session cache or anything else).
Anyway, I use overloading ISession.Delete(query)where the request is as trivial as it is from Dummy where Id=5.
My question is: why does NHibernate retrieve an object before deleting it? As far as I can see, I pay for a double trip to the server for an operation that intuitively should take only one round trip.
Is there a way to remove an object from the database by its type and ID using NHibernate, so it takes only one round?
source
share