Beginner |
|
Joined: Thu Sep 16, 2004 8:14 pm Posts: 27
|
I am using Hibernate 3.2.5 and I would like to mark some properties of a persisted class as immutable. I want to be able to create new instances of this class and save those values, but once saved I want the setter to throw an exception stating that the property cannot be modified. Is that what the method level annotation @Immutable is supposed to do?
I have annotated one of my methods as:
@Immutable
@Column(nullable=false)
public String getSummary() {
return _summary;
}
but after retrieving one of these objects from the database I can call setSummary("foo") and the value gets persisted.
Thanks in advance for any help with this.
|
|