1

I just noticed that the @Entity annotation was deprecated in Hibernate 4, now I need to replace it somehow. I have the following entity class:

@Entity
public class Employee{

    @GeneratedValue(strategy=GenerationType.AUTO)
    private Integer id;
    @Column(name="name")
    private String name;

    public void setId(Integer id){
        this.id = id;
    }

    public Integer getId(){
        return id;
    }

    public void setName(String name){
        this.name = name;
    }

    public String getName(){
        return name;
    }
}

What annotation should I use instead in that case?

onetwothree
  • 672
  • 1
  • 10
  • 20
user3663882
  • 6,957
  • 10
  • 51
  • 92

1 Answers1

2

@Entity is removed you should use @DynamicUpdate instead.

Example : Configure @DynamicUpdate properties via annotation.

@Entity
@Table(name = "table_name", catalog = "catalog_name")
@org.hibernate.annotations.Entity(
        dynamicUpdate = true
)
public class ClassName implements java.io.Serializable {

}
atish shimpi
  • 4,873
  • 2
  • 32
  • 50