Forums

Home » Liferay Portal » English » 3. Development

Combination View Flat View Tree View
Threads [ Previous | Next ]
toggle
Thanasis Iliopoulos
map hibernate object with liferay internal table - many to many relation
February 18, 2013 7:24 AM
Answer

Thanasis Iliopoulos

Rank: New Member

Posts: 4

Join Date: September 3, 2012

Recent Posts

i would like to know - if possible - how can i map a hibernate object model to an internal liferay table 'user_'.

My Hibernate Object model is:

 1@Entity
 2@Table(name = "imageviewer_crreviewprotocol")
 3public class CRReviewProtocol implements Serializable {
 4
 5private static final long serialVersionUID = 1L;
 6
 7@Id
 8@GeneratedValue
 9@Column(name = "RevProtId")
10private Long revProtId;
11
12@Column(name = "RevProtDescription")
13private String RevProtDescription;
14
15@ManyToMany(cascade = {CascadeType.ALL})
16@JoinTable(name="imageviewer_revprot_features",
17joinColumns={@JoinColumn(name="RevProtId")},
18inverseJoinColumns={@JoinColumn(name="VarId")})
19private Set<CRVariable> crvariables = new HashSet<CRVariable>();
20
21@ManyToMany(cascade = {CascadeType.ALL})
22@JoinTable(name="imageviewer_revprot_patients",
23joinColumns={@JoinColumn(name="RevProtId")},
24inverseJoinColumns={@JoinColumn(name="ImPatientId")})
25private Set<CRImageData> crimagedata = new HashSet<CRImageData>();
26Which builds a main table 'imageviewer_crreviewprotocol' and two other intermediate tables for M-N relations with two other entities.


I would like to have another intermediate M-N table which will store internal (liferay) userId and RevProtId. But how am i going to map this? I have tried code like:

1@ManyToMany(cascade = {CascadeType.ALL})
2@JoinTable(name="imageviewer_revprot_reviewers",
3joinColumns={@JoinColumn(name="RevProtId")},
4inverseJoinColumns={@JoinColumn(name="ReviewerId")})
5//private Set<BigInteger> userId = new HashSet<BigInteger>();
6//private Set<User> user = new HashSet<User>();


But obviously i am missing something!

Anybody with relevant experience?
Thanasis Iliopoulos
RE: map hibernate object with liferay internal table - many to many relatio
February 18, 2013 7:25 AM
Answer

Thanasis Iliopoulos

Rank: New Member

Posts: 4

Join Date: September 3, 2012

Recent Posts

Is there any way to set (import, or set as mapping class) liferay table user_ in hibernate configuration xml file?