@Immutable with @Entity and insertable = false and updateable = false on @Column

If I use the @Immutable annotation for an object and add the updatable and insertable attributes to the insertable annotation, will it be redundant?

  @Entity
 @Immutable
 public class SomeEntity ...
 {
  @Column (name = "xyz" updatable = false, insertable = false)
  private String xyz;
  ...
 }
+4
source share
1 answer

These are two methods you can use to make your entity immutable. So yes, this is redundant. I know that Hibernate (if that's what you are using) will do some optimizations for the annotated @Immutable object. I can not say for updatable=false .

+1
source

Source: https://habr.com/ru/post/1337423/


All Articles