How to make Hibernate Object mutable


Using XML mapping file

<hibernate-mapping>  
  <class name="com.javatpoint.mypackage.Employee" table="emp1000" mutable="false">  
    <id name="id">  
     <generator class="assigned"></generator>  
    </id>            
    <property name="firstName"></property>  
    <property name="lastName"></property>  
   </class>     
</hibernate-mapping>         


Using Annotation: @Mutable

    public class Employee 
    {  
    private int id;  
    private String firstName,lastName;  
      
    public int getId() 
    {  
        return id;  
    }  
    public void setId(int id) 
    {  
        this.id = id;  
    }  
    public String getFirstName() 
    {  
        return firstName;  
    }  
    public void setFirstName(String firstName) 
    {  
        this.firstName = firstName;  
    }  
    public String getLastName() 
    {  
        return lastName;  
    }  
    public void setLastName(String lastName) 
    {  
        this.lastName = lastName;  
    }             
    }