I use JPA (Hibernate implementation) with JEE running on WildFly 17 on Linux Ubuntu 18.04.
I have the following source code:
@TransactionAttribute(TransactionAttributeType.REQUIRED)
public Ave daveAnlegen(Ave ave) {
Ave existingAve = checkExistsAve(ave.getStartDate(), ave.getObjekt());
if (existingAve != null) {
existingAve.setEndDate(ave.getEndDate());
existingAve.setKaufInteressenten(ave.getKaufInteressenten());
existingAve.setAveInvitLinks(ave.getAveInvitLinks());
existingAve.setAngebotType(ave.getAngebotType());
existingAve = this.em.merge(existingAve);
return existingAve;
} else {
ave = this.em.merge(ave);
return ave;
}
}
When I debug the code I have the use-case in which existingAve is NOT NULL and the line
existingAve.setEndDate(ave.getEndDate());
gets exscuted, so that endDate changes from 13.02 to 14.02, I expect that after the line
existingAve = this.em.merge(existingAve);
gets executed and the method completes, the value of the EndDate in tha database will change from 13.02 to 14.02, but this does not happen. The same holds for the field AngebotType: I see that after the line
existingAve.setAngebotType(ave.getAngebotType());
the field valie changes from "geschlossen" to "offen", but the value of the database field does NOT change.
Any suggestion are welcome!
Thank you and kind regards: Alex