2
考虑以下JPA实体。我的应用程序实例类必须始终具有4个特殊的Envelope实例的OneToOne引用,但它也有一组0-infinite用户定义的信封。这甚至有可能吗?单向和/或双向引用可能吗?JPA实体映射为OneToOne以及OneToMany
@Entity(name = "Application_Instance")
public class ApplicationInstance implements Serializable {
@Id
private int databaseId;
private Envelope accountTransfersEnvelope = new Envelope("Account Transfers");
@OneToOne
private Envelope newTransationsEnvelope = new Envelope("New Transactions");
@OneToOne
private Envelope incomeEnvelope = new Envelope("Income Envelope");
@OneToOne
private Envelope creditCarEnvelope= new Envelope("Credit Card");
@OneToMany
protected Set<Envelope> userEnvelopes = new HashSet<Envelope>();
//rest of class
}