Let's start with an entity with an embedded structure.
@Entity
public class MyEntity implements Serializable {
@Embedded private MyEmbeddedObject myEmbeddedObject;
...
}
@Embeddable
public class MyEmbeddedObject implements Serializable {
@Column(name = "first_col", precision = 38, scale = 18)
private Double firstCol;
...
}
The content here is not important. These objects are created in a Java FX application. Once created or modified, they are stored in a database using JPA repositories.
I've observed the following behavior and would like to know if this is normal:
- When an object
MyEntity
is created the very first time from my Java FX interface, JPA will store everything properly in the database, which is the expected behavior. - When I try to modify
firstCol
from the interface, this modification is displayed properly but its value will not be stored unlessMyEmbeddedObject
is a protected variable ofMyObject
. IfMyEmbeddedObject
is private, it becomes unmodifiable. Values can always be displayed but cannot be modified.
Anyone has any ideas why? This is not a blocking situation because I have a workaround. I'm curious if someone knows if this behavior is normal.