我有一个实体,出于多种原因(为什么有人在使用 JPA 映射类时应该在 getter 或 setter 上添加注释?)我们正在注释 getter 方法而不是字段:
protected Long id;
...
@Id
@GeneratedValue(...)
@SequenceGenerator(...)
@Column(name = "id")
public Long getId()
{
return id;
}
public void setId(Long id)
{
this.id = id;
}
调用时:
javers.findChanges(QueryBuilder.byInstanceId(5, MyModel.class).build())
JaVers 抛出以下异常:
JaversException: ENTITY_WITHOUT_ID Class 'com.myproject.model.MyModel' mapped as Entity has no Id property. Use @Id annotation to mark unique and not-null Entity identifier.
是否支持?