[hibernate-dev] Immutable entities
Steve Ebersole
steve at hibernate.org
Tue Jun 24 13:58:16 EDT 2008
Mutable entities should be creatable as well as deletable.
The difficulty with immutable and checking for changes (to see whether
we should throw an exception) is that of performance in the case of
simple reattachment of detached entities. This is less an issue in the
case of merge()/saveOrUpdateCopy(). But in the simple case reattachment
this would require a select to know the previous values. So for
consistency-sake (I assume) immutable="true" always just ignores any
potential changes.
We could certainly add a feature for the optional ability to perform the
checking (which I agree would be more desirable, probably, as a user).
--
Steve Ebersole
Project Lead
http://hibernate.org
steve at hibernate.org
Principal Software Engineer
JBoss, a division of Red Hat
http://jboss.com
http://redhat.com
steve.ebersole at jboss.com
steve.ebersole at redhat.com
On Tue, 2008-06-24 at 13:05 +0200, Hardy Ferentschik wrote:
> On Mon, 23 Jun 2008 17:05:52 +0200, Steve Ebersole <steve at hibernate.org>
> wrote:
>
> > What happens if you remove the unecessary save() call after changing the
> > name?
>
> Same, same. The update gets ignore, but no exception is thrown.
>
> There is a ImmutableTest in the core and it seems to also not expect an
> Exception. However, as I mentioned in my other email - updating a mutable
> collection seems to throw an exception. I am also able to delete mutable
> entities. Is this correct?
>
> --Hardy
>
>
>
>
More information about the hibernate-dev
mailing list