hibernate多表连接 查询的解决方案(二)

2014-11-24 09:12:33 · 作者: · 浏览: 4
Createtime(Date createtime) {
this.createtime = createtime;
}
@Column(name = "FLOWTYPE", length = 32)
public String getFlowtype() {
return this.flowtype;
}
public void setFlowtype(String flowtype) {
this.flowtype = flowtype;
}
@Column(name = "FLOWCODE", length = 32)
public String getFlowcode() {
return this.flowcode;
}
public void setFlowcode(String flowcode) {
this.flowcode = flowcode;
}
@Column(name = "FORMID", length = 32)
public String getFormid() {
return this.formid;
}
public void setFormid(String formid) {
this.formid = formid;
}
@Column(name = "STATE", length = 1)
public String getState() {
return this.state;
}
public void setState(String state) {
this.state = state;
}
@Column(name = "CURRENTUSERID", length = 32)
public String getCurrentuserid() {
return this.currentuserid;
}
public void setCurrentuserid(String currentuserid) {
this.currentuserid = currentuserid;
}
@Column(name = "PFLOWTYPE", length = 32)
public String getPflowtype() {
return this.pflowtype;
}
public void setPflowtype(String pflowtype) {
this.pflowtype = pflowtype;
}
@Column(name = "FORM_NO", length = 32)
public String getFormNo() {
return formNo;
}
public void setFormNo(String formNo) {
this.formNo = formNo;
}
@Transient //这种是临时属性的注解
public String getTask() {
return task;
}
public void setTask(String task) {
this.task = task;
}
@Transient
public String getLastAudiUser() {
return lastAudiUser;
}
public void setLastAudiUser(String lastAudiUser) {
this.lastAudiUser = lastAudiUser;
}
@Transient
public String getNextUser() {
return nextUser;
}
public void setNextUser(String nextUser) {
this.nextUser = nextUser;
}
@Transient
public String getUserName() {
return userName;
}
public void setUserName(String userName) {
this.userName = userName;
}
@Transient
public String getDeptName() {
return deptName;
}
public void setDeptName(String deptName) {
this.deptName = deptName;
}
}
HQL查询语句:
//hql多表连接 拼装实体
String hql="select new com.entity.flow.FlowRuInfo(t.id,t.deptid,t.processinstanceid,"
+"t.content, t.creator, t.createtime, t.flowtype,"
+"t.flowcode, t.formid, t.state, t.currentuserid,"
+"t.pflowtype, t.formNo, t.creator, t.creator,"
+"t.creator, u.empName, d.depName) from FlowRuInfo t,Department d,User u where t.creator=u.userid and d.depId=t.deptid order by t.createtime desc";