Nulling an embedded object does not affect the database upon merge [message #1038948] |
Thu, 11 April 2013 10:38  |
Eclipse User |
|
|
|
I have the following classes:
@Entity
public class Reminder {
private Location location;
// other fields and methods
}
and
@Embeddable
public class Location {
private double latitude;
private double longitude;
// no other fields here, just getters and setters
My database has a table REMINDER with columns LATITUDE and LONGITUDE to store the embedded field.
If I call someReminder.setLocation(someLocation), followed by em.merge(someReminder), the LATITUDE and LONGITUDE columns are filled in as expected. However, if I call someReminder.setLocation(null), followed by em.merge(someReminder), the LATITUDE and LONGITUDE columns are unchanged. Re-reading someReminder from the database gives back the previously stored location.
I am running on GlassFish 3.1.2.2 with EclipseLink 2.3.2.
And now for the strangest part:
If I run the exact same code on Java SE (with a different EntityManager and different transactions ofcourse, but using the same EclipseLink 2.3.2), I do get the expected results: the merge causes the columns LATITUDE and LONGITUDE to be nulled out.
Why isn't this working on Java EE ?
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.27818 seconds