0
我有一個像下面的表格模型:休眠關係
@Entity
@Table(name="RULEADMIN_QUESTIONNAIRE")
public class Questionnaire {
@Id
@GeneratedValue(strategy=GenerationType.AUTO)
@Column(name = "QUESTID")
private long questionID;
@Column(name = "QUESTION")
private String question;
@GeneratedValue(strategy=GenerationType.AUTO)
@Column(name = "QUESTORDER")
private long questionOrder;
@Column(name = "QUESTCATEGORYID")
private long questionCatgoryID;
@Column(name = "QUESTREFERENCESTRING")
private String questionReferenceString;
@Column(name = "ACTIVEFLAG")
private long activeFlag;
@Column(name = "LASTMODUSERID")
private long lastModifiedUserID;
@Column(name = "LASTMODDATE")
private Date lastModifiedDate;
@OneToMany(cascade=CascadeType.ALL)
@JoinColumn(name="QUESTID")
@Transient
private List<QuestionAnswerOption> questionAnswerOptions;
public Questionnaire() {
}
.....list of setters and getters
}
這裏QUESTID
和QUESTORDER
將具有相同的價值,QUESTID
會得到自動生成的。但是我也希望QUESTORDER
的值相同,因爲兩者都具有相同的值。我嘗試了註釋@GeneratedValue(strategy=GenerationType.AUTO)
,但它沒有獲得價值。我怎樣才能得到QUESTID
到QUESTORDER
呢?
我不知道如果問題還有其他問題,但在你的情況下,爲什麼你不能僅僅使用QUESTID本身? QUESTORDER有什麼需要? – Manoj 2011-10-17 12:15:52