How can we mark an entity/collection as immutable in Hibernate?

In Hibernate, by default an entity or collection is mutable. We can add, delete or update an entity/collection.

To mark an entity/collection as immutable, we can use one of the following:

  • @Immutable: We can use the annotation @Immutable to mark an entity/collection immutable.
  • XML file: We can also set the property mutable=false in the XML file for an entity to make it immutable.
Read the full book at www.amazon.com
Posted in Hibernate, Hibernate Interview Questions

Leave a Reply

Your email address will not be published. Required fields are marked *

*