hi, i don't have any knowledge about your object model, but i would just set this property in the constructor, and have a setter that's not normally accessible. the client would have to be malicious to mess up the value in this case... :)
viktor On Thu, 9 Jan 2003 13:59:46 -0700 , "Russell Smyth" <[EMAIL PROTECTED]> said: > no - I need to allow setting ONCE only - ie set it then you cannot > modify it. > > We are currently working around this by having the setter check for > id=0 (0 is our "unsaved-value") and if it is not the set fails > (throws an exception -- This would of course cause Hibernate to > choke on reloading an object, as id is set first.) > > to allow Hibernate to work, we created hibernate-specific getters > and setters (private) and in hibernate mapped those to the db > columns rather than the real properties. > > This works, giving Hibernate a "private back door" but I dont > particularly > like the model. I would preferr to be able to trigger access by knowing > the method was being called within a "hibernate process". > > > -----Original Message----- > > From: Viktor Szathmary [mailto:[EMAIL PROTECTED]] > > Sent: Thursday, January 09, 2003 1:51 PM > > To: Russell Smyth; [EMAIL PROTECTED] > > Subject: Re: [Hibernate] Possible additions to Lifecycle interface > > > > > > hi, > > > > On Thu, 9 Jan 2003 10:03:32 -0700, "Russell Smyth" > > <[EMAIL PROTECTED]> said: > > > > > our current main use is a field that is write-once. We would like to > > > dissallow "re-setting" of the field once it is set, but by > > dissallowing > > > resetting the property, hibernate cannot re-instantiate the object > > > either! > > > > wouldn't making the setter method protected help? > > > > > > > > viktor > > -- > > > > [EMAIL PROTECTED] > > > > -- > > http://fastmail.fm - A fast, anti-spam email service. > > > -- [EMAIL PROTECTED] -- http://fastmail.fm - Same, same, but different... ------------------------------------------------------- This SF.NET email is sponsored by: SourceForge Enterprise Edition + IBM + LinuxWorld = Something 2 See! http://www.vasoftware.com _______________________________________________ Tapestry-developer mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/tapestry-developer
