简单的HQL问题
sql语句:select t2.id,t2.title,t2.content,t2.date,t2.sendUserId from t_receive_user t1 left join t_email t2 on t1.emailId=t2.id where t1.userId=67;
对应的hql语句该怎么写?
t_receive_user---->ReceiveUser类
t_Email ------>Email类
t_user ------>User类
Email------>ReceiveUser one2money
user ------>ReceiveUser one2money
package com.centerSoft.soms.model;
import java.io.Serializable;
import java.util.Set;
import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;
@Entity
@Table(name = "t_email")
public class Email extends BaseEntity implements Serializable {
private int id; // 标识该邮件的唯一id
private String title;// 邮件标题
private String content;// 邮件内容
private boolean hasAccessory;// 是否有附件
private String path;// 附件路径
private java.util.Date date;// 写信日期
private User sendUser;// 发件人 money to one
private Set<ReceiveUser> receiveUsers;// 收件人
@Id
@GeneratedValue
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getContent() {
return content;
}
public void setContent(String content) {
this.content = content;
}
public boolean isHasAccessory() {
return hasAccessory;
}
public void setHasAccessory(boolean hasAccessory) {
this.hasAccessory = hasAccessory;
}
public String getPath() {
return path;
}
public void setPath(String path) {
this.path = path;
}
public java.util.Date getDate() {
return date;
}
public void setDate(java.util.Date date) {
this.date = date;
}
@ManyToOne(fetch=FetchType.LAZY)
@JoinColumn(name="sendUserId")
public User getSendUser() {
return sendUser;
}
public void setSendUser(User sendUser) {
this.sendUser = sendUser;
}
public void setReceiveUsers(Set<ReceiveUser> receiveUsers) {
this.receiveUsers = receiveUsers;
}
@OneToMany(mappedBy="email",fetch=FetchType.LAZY,cascade=CascadeType.REMOVE)
public Set<ReceiveUser> getReceiveUsers() {
return receiveUsers;
}
}
//---------------------------------------
package com.centerSoft.soms.model;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
im