environment: playframework 2.5 ebean 7.6.1 Event: Update () is not executed for the inherited model.
The reason is that the setter set it to the inherited value. It will be executed if you set this. ~ Instead of super. ~. According to the specifications, the parent class had a field and was set at the inheritance destination. I think the destination where the setter is actually called and the value is set is the same. Why?
Member.java
@Entity
@Table(name = "member")
public class MemberDatas extends AbstractMemberDatas {
public void setId(Long Id) {
super.Id = Id;
}
public void setMemberId(Long memberId) {
super.memberId = memberId;
}
public Long getId() {
return Id;
}
public Long getMemberId() {
return memberId;
}
}
AbstractMember.java
@MappedSuperclass
public abstract class AbstractSentenceDictDatas extends Model {
@Column(name = "id")
protected Long Id;
@Column(name = "memberId")
protected Long memberId;
}
MemberService.java
~
Member member = new Member();
member.setId(1);
member.setMemberId(1);
member.update();
~
Recommended Posts