Immutable « Entity « JPA Q&A

1. @Immutable vs @Entity(mutable=false) in Hibernate

What is the difference between the two if any? Should 1 or both be used on an entity?

2. Possible to have immutable JPA entities?

In our hibernate project, the entities are coded using the java beans pattern. There's quite a few spots in our code where someone has forgotten a to set a mutator ...

3. Cannot make an immutable entity modifiable (3.5.0)

I tried dropping Hibernate 3.5.0 into a project that currently uses Hibernate 3.3.2, but I started running into an exception that I hadn't experienced before: IllegalStateException: Cannot make an immutable entity modifiable. As far as I can tell, this is happening when refresh is called on a detached object for a class (representing a database view) that is mapped with mutable="false". ...