I want to persist a List of Embeddable Objects in an Entity. But without creating a new Table for the Objects in the List.
I want to persist the Entity in a way that the List of coordinates is serialized to a String and saved in the column named "coordinates" of the Entity Entity_A.
I know that i shouldn't do this because it's bad design. But in this case it is needed.
My Attempt to do it:
@Entity
class Entity_A implements Serializable {
//...
private List<Coordinate> coordinates;
}
@Embeddable
class Coordinate implements Serializable {
private Float lat;
private Float lng;
private Float alt;
}
It doesn't work. i don't get any error.
Do you have any ideas how i can do it?
Edit:
Coordinate needs to be embeddable, because i use it elsewhere.