1、@Transient 使用場景:一般在模型中對應(yīng)某一個字段的屬性中的set和get方法中。作用是數(shù)據(jù)與數(shù)據(jù)庫中不一一對應(yīng)。如:
/*@Transient public String getModulename() {
return modulename;
}
public void setModulename(String modulename) {
this.modulename = modulename;
}*/
2、@ManyToOne
多對一。可以把另一個模型對應(yīng)過來。在查詢時,無需要聯(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
老天 閱讀(244)
評論(0) 編輯 收藏