Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » EclipseLink PreUpdate on OneToOne Relationship not persisted(PreUpdate)
EclipseLink PreUpdate on OneToOne Relationship not persisted [message #1810111] Wed, 31 July 2019 13:34
Sara  Rüegg is currently offline Sara RüeggFriend
Messages: 2
Registered: July 2019
Junior Member
I have a PreUpdate method which gets executed, but when flushing the entityManager the changes on the dependent entity are not persisted.

Following is my minimal (non) working example:


@Table(name = "HOUSE")
public class House {

@Column(name = "ID")
private long id;

@OneToOne(cascade = {CascadeType.ALL})
@JoinColumn(name = "INFO_ID")
private HouseInfo info;

protected void komplettiereEingabeWerte() {

//getters and setters

@Table(name = "HOUSE_INFO")
public class HouseInfo {

@Column(name = "ID")
private long id;

@Column(name = "CODE")
private String code;

//getters and setters

public void testPreUpdate() {
House house = entityManager.find(House.class, 1L);
house.setInfo(new HouseInfo());

house = entityManager.find(House.class, 1L);
assertEquals("TEST", house.getInfo().getCode());
The Test fails due to an AssertionError on the last line as Code is null.

I am using EclipseLink version 2.7.4 with an Oracle DB (the same behaviour was also observed with an in memory Derby DB) and the Test is running with UnitilsJUnit4 in a SpringApplicationContext.

How can I fix this problem? Thank you.
Previous Topic:NotReadablePropertyException while using SpringData projection
Next Topic:Passing Collection List to In clause in nativeQuery - EclipseLink
Goto Forum:

Current Time: Thu Jun 08 12:09:57 GMT 2023

Powered by FUDForum. Page generated in 0.01678 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top