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