Why? Here is code:
@Entity
public class EventProgressFishSoup extends Model {
@JsonIgnore
@OneToOne(optional = false, fetch = FetchType.LAZY)
public User user;
public int result;
public int received;
@DbJsonB
@Column(nullable = false)
public JsonNode progress;
public static void updateResult(int user_id, JsonNode json) {
EventProgressFishSoup record = DB.find(EventProgressFishSoup.class).where().eq("user_id", user_id).findOne();
if (record != null) {
System.out.println(DB.beanState(record).isNew()); // true
var bean = ((EntityBean) record)._ebean_getIntercept();
System.out.println("isNew before any changes: " + bean.isNew()); // true
System.out.println("isReference: " + bean.isReference()); // false
record.progress = progress;
System.out.println("isUpdate after: " + bean.isUpdate()); // false
System.out.println("isNew after: " + bean.isNew()); // true
save(); // DataIntegrityException: user = NULL, tries INSERT instead of UPDATE
}
// ....
}
}
Ebean 17.1.0, Ebean Agent 17.1.0
Class is enhanced, of course.
Why? Here is code:
Ebean 17.1.0, Ebean Agent 17.1.0
Class is enhanced, of course.