This content has been marked as final.
Show 3 replies
-
1. Re: multi column primary key
cesarizurieta Jan 30, 2006 12:10 PM (in response to rgalt)You should use a PK Entity something like:
@Entity @Table(name="userappconfig") public class Userappconfig implements Serializable { private static final long serialVersionUID = -1865032716488077338L; private String myValue = null; private UserappconfigPK id; @Id(generate=GeneratorType.NONE) public UserappconfigPK getId() { return id; } public void setId(UserappconfigPK id) { this.id = id; } @Column(name="confvalue",nullable=true) public String getValue() { return myValue; } public void setValue(String mvalue) { myValue = mvalue; } }
@Embeddable public class UserappconfigPK implements Serializable { private static final long serialVersionUID = -1865032716488077338L; private int applicationid = 0; private int userid = 0; private String myEntry = null; @Column(name="userid") public int getUserid() { return userid; } public void setUserid(int id) { userid = id; } @Column(name="appid") public int getApplicationid() { return applicationid; } public void setApplicationid(int id) { applicationid = id; } @Column(name="confentry") public String getEntry() { return myEntry; } public void setEntry(String entry) { myEntry = entry; }
-
2. Re: multi column primary key
bill.burke Jan 30, 2006 12:17 PM (in response to rgalt)That is wrong. You should be using @EmbeddedId or @IdClass.
-
3. Re: multi column primary key
rgalt Feb 3, 2006 11:32 AM (in response to rgalt)Thanks a lot, it works.