我想知道 - 如果可能 - 我如何将hibernate对象模型映射到内部liferay表'user _'。
我的Hibernate对象模型是:
@Entity
@Table(name = "imageviewer_crreviewprotocol")
public class CRReviewProtocol implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue
@Column(name = "RevProtId")
private Long revProtId;
@Column(name = "RevProtDescription")
private String RevProtDescription;
@ManyToMany(cascade = {CascadeType.ALL})
@JoinTable(name="imageviewer_revprot_features",
joinColumns={@JoinColumn(name="RevProtId")},
inverseJoinColumns={@JoinColumn(name="VarId")})
private Set<CRVariable> crvariables = new HashSet<CRVariable>();
@ManyToMany(cascade = {CascadeType.ALL})
@JoinTable(name="imageviewer_revprot_patients",
joinColumns={@JoinColumn(name="RevProtId")},
inverseJoinColumns={@JoinColumn(name="ImPatientId")})
private Set<CRImageData> crimagedata = new HashSet<CRImageData>();
构建主表'imageviewer_crreviewprotocol'和另外两个与其他两个实体的M-N关系的中间表。
我想有另一个中间M-N表,它将存储内部(liferay)userId和RevProtId。但是我该如何映射呢?我尝试过像:
这样的代码@ManyToMany(cascade = {CascadeType.ALL})
@JoinTable(name="imageviewer_revprot_reviewers",
joinColumns={@JoinColumn(name="RevProtId")},
inverseJoinColumns={@JoinColumn(name="ReviewerId")})
//private Set<BigInteger> userId = new HashSet<BigInteger>();
//private Set<User> user = new HashSet<User>();
但显然我错过了什么!
有相关经验的人吗?