| Re: [eclipselink-users] Unidirectional @OneToMany: is it possible with not nullable foreign key? |
|
Card object can't exist without the corresponding Transaction
object.
That means Card is not an independent object
(Entity) but rather an owned object (Embeddable),
so OneToMany can't be used (the target must be an
Entity).
I would define Card as Embeddable and use
ElementCollection:
@Entity
@Table(name =
"TRANS",
schema="TEST")
public
class TransactionType {
...
@ElementCollection()
@CollectionTable(name = "CARD", schema="TEST", @JoinColumn(name="TRANS_ID"))
@AttributeOverrides({
@AttributeOverride(name="a", column=@Column(name="URN"), @AttributeOverride(name="b", column=@Column(name="NUMBER"), }) public java.util.Set<Card> getCards() {
return cards;
}
}
@Embeddable
public
class CardUseTypeJAXB {
int a;
int b;
?
}
|