frosty
frosty

Reputation: 5370

nhibernate automatically updating

Currently i'm using the criteria api to select orders from 6 months ago. I can see that alot of these orders are getting updated. ( i'm using nhprof ). However i'm not using Update.

I have a basic understanding that NH does maintenance consistency. What would be the likely cause that would make nh makes this update. I have done the following recently.

1) i've downloaded this db 1 week ago. So orders from 6 months ago might not be in the local cache.

2) 3 days ago i use sql to update a bit value

Upvotes: 0

Views: 59

Answers (1)

ghallas
ghallas

Reputation: 305

We had a case with similar symptoms, maybe the causes are similar too.

On the DB, we had a column with floats that allowed nulls. However, the corresponding entity class did not mark the field mapped to that column as Nullable.

Note that we are using the Transaction-per-Request strategy. So, when we committed the transaction, nhibernate updated all the accessed entities with a 0 value where it was null.

Maybe there's such a discrepancy between your DB and mapped objects too?

Upvotes: 1

Related Questions