|
From: NHibernate J. <mik...@us...> - 2006-11-16 21:22:34
|
Resetting of properties after initial set violates constraints we want to p=
rotect
---------------------------------------------------------------------------=
------
Key: NH-814
URL: http://jira.nhibernate.org/browse/NH-814
Project: NHibernate
Type: Improvement
Versions: 1.0.2 =20
Reporter: Jim Showalter
We have properties on objects that are supposed to be set only once, when f=
irst reading an object back from the database. Once in memory, they are not=
supposed to be set again, and attempting to do so is supposed to throw an =
exception. Unfortunately, nhibernate's behavior appears to be less predicta=
ble than we had thought. It assigns properties more than once. For example,=
when merging a disconnected object, it loads one from the database (thus s=
etting the properties), and then sets them again from the other object, thu=
s violating the set-once rule. There are other cases similar to this. We mo=
dified our rule to allow setting to null (or some other value indicating no=
t-yet-set) as many times as desired, then setting to some actual value, and=
allowing setting to that same value as many times as desired. Setting to a=
different value once set throws an exception. This seems to pacify nhibern=
ate, but we're not certain that it will work in all cases, and the behavior=
of nhibernate as far as resetting properties is concerned is undefined. Ou=
r request is for nhibernate to be enhanced to have a notion of set-once, wh=
ich would be stated in the HBM file. This would make a property immutable, =
with the sole setting of that property to be done on reading in from the da=
tabase. On save, a set-once property would be assumed to have already been =
set--nhibernate would not set it itself when saving, only when reading.
This same request has been filed for hibernate as HHH-2245.
--=20
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://jira.nhibernate.org/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira
|