Let's say I have:
class Unit {
private TextContainer source;
private List<TextContainer> targets;
}
Can I annotate class TextContainer in such a way that it works within both relationships? TextContainer must be either source or target.
Let's say I have:
class Unit {
private TextContainer source;
private List<TextContainer> targets;
}
Can I annotate class TextContainer in such a way that it works within both relationships? TextContainer must be either source or target.
You need to annotate the relations with TextContainer
in the Unit
class. Something like this:
class Unit {
@ManyToOne(cascade=CascadeType.ALL)
private TextContainer source;
@OneToMany(cascade=CascadeType.ALL)
private List<TextContainer> targets;
}