title: Hibernate entities on the same database table for read and write
body: <p>In our Spring Boot application we have two entities for the same table.</p>
  <pre><code>@Entity
  @Table(name = &quot;TBL_DATA&quot;)
  @Immutable
  public class DataReadEntity {
  
     // getters only
     ...
     // specific @OneToMany and @OneToOne relations only present in this entity
  }
  
  @Entity
  @Table(name = &quot;TBL_DATA&quot;)
  @DynamicUpdate
  public class DataWriteEntity {
  
    // getters and setters
  }
  </code></pre>
  <p>DataReadEntity is used for data search only and is always used in a separate API. DataWriteEntity is used for fetching the whole object and updating it.</p>
  <p>The problem is that hibernate still shows warning when updating DataWriteEntity with JPA criteria API
  <code>SessionImpl - HHH000487: The query: [here goes update query] attempts to update an immutable entity: [TBL_DATA]</code> and update is successful.</p>
  <p>So the question is - should we remove <code>@Immutable</code> annotation or just ignore this warning, because it is working as expected? It is considered that DataReadEntity will be never used for update operations (setters are not even implemented).</p>
  <p>Spring Boot Application is working with default configuration - <code>spring.jpa.open-in-view is enabled by default</code>.</p>