@Entity
@Table(name="FOO")
public class Foo {
private UUID fooId;
@OneToOne
private Bar bar;
}
@Entity
@Table(name="BAR")
public class Bar {
private UUID barId;
//No corresponding mapping to Foo.class
}
Specifies a one-way relationship between one Foo
object to one Bar
object.
The Foo
objects are stored as rows in a table called FOO
. The Bar
objects are stored as rows in a table called BAR
.
Notice that there is no mapping of Bar
objects back to Foo
objects. Bar
objects can be manipulated freely without affecting Foo
objects.