@Target(value={TYPE,METHOD,FIELD}) @Retention(value=RUNTIME) public @interface Immutable
Mark an Entity, a Collection, or an Attribute type as immutable. No annotation means the element is mutable. <p> An immutable entity may not be updated by the application. Updates to an immutable entity will be ignored, but no exception is thrown. @Immutable must be used on root entities only. </p> <p> @Immutable placed on a collection makes the collection immutable, meaning additions and deletions to and from the collection are not allowed. A <i>HibernateException</i> is thrown in this case. </p> <p> An immutable attribute type will not be copied in the currently running Persistence Context in order to detect if the underlying value is dirty. As a result loading the entity will require less memory and checking changes will be much faster. </p>
Copyright © 2001-2018 Red Hat, Inc. All Rights Reserved.