tags:

views:

184

answers:

2

For my current project, we use a nHibernate session to retrieve the object, and another session to update the changes we've made to the object in between the two session. If we use SaveOrUpdate(), nHibernate will typically do a select-then-update (so, two calls to the database).

However, our own business objects already keep track of changes. So, we'd ideally want to intercept within nHibernate and vote whether the object has been changed or not (without letting nHibernate do the select-statement).

Would that be possible with an interceptor?

A: 

with the interceptor you can intercept all querys and change then or add some sql to don't now if you can stop nhibernate for doing a select query

Marco
A: 

You can use your own custom Persister.
Check this - https://www.hibernate.org/161.html

Padmarag