日期:2014-05-19 浏览次数:20707 次
public ArrayList<TieUser> getAllReplyTie(int tieId) {
Session session=HibernateUtil.openSession();
Transaction ts=session.beginTransaction();
Query query=session.createSQLQuery("" +
"select u.headImg as headImg,r.replyDate as date from y_reply as r " +
"left join y_user as u on r.userId=u.id where r.tieId=?");
query.setInteger(0,tieId);
System.out.println("query:"+query);
ts.commit();
return new ArrayList<TieUser>(query.list());
}
public class TieUser {
private String title;
private String name;
private String email;
private String headImg;
private String content;
private int userId;
private String date;
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getName() {
return name;
}
/*...*/