1、@Transient 使用場(chǎng)景:一般在模型中對(duì)應(yīng)某一個(gè)字段的屬性中的set和get方法中。作用是數(shù)據(jù)與數(shù)據(jù)庫(kù)中不一一對(duì)應(yīng)。如:
/*@Transient public String getModulename() {
return modulename;
}
public void setModulename(String modulename) {
this.modulename = modulename;
}*/
2、@ManyToOne
多對(duì)一。可以把另一個(gè)模型對(duì)應(yīng)過來。在查詢時(shí),無需要聯(lián)表查詢。
@JoinColumn(name="moduleid",insertable=false,updatable=false)
@NotFound(action=NotFoundAction.IGNORE)
public CateModule getCateModule() {
return cateModule;
}
public void setCateModule(CateModule cateModule) {
this.cateModule = cateModule;
}
posted on 2012-12-03 11:09
老天 閱讀(249)
評(píng)論(0) 編輯 收藏