1

我想知道 - 如果可能的话 - 我如何将休眠对象模型映射到内部 liferay 表“user_”。

我的休眠对象模型是:

@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>();

它为与其他两个实体的 MN 关系构建了一个主表“imageviewer_crreviewprotocol”和另外两个中间表。

我想要另一个中间 MN 表来存储内部(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>();

但显然我错过了一些东西!

有相关经验的人吗?

4

0 回答 0