Assume we have the following classes:
@Entity public class Restaurant { /* @Embedded */ private Location location; private int phoneNumber; } @Embeddable public class Location { private double latitude; private double longitude; }
According to the documentation, the @Embedded annotation "Specifies a persistent field or property of an entity whose value is an instance of an embeddable class. The embeddable class must be annotated as Embeddable
."
So the Location class is annotated as instructed, but what difference will it make if we would annotate the Location field with the @Embedded annotation? And do we have to use this annotation also?
In addition, does CascadeType affects embeddable objects?