日期:2014-05-20  浏览次数:20706 次

高分求:HQL里字符串连接,进者有分
oracle库,
我要实现select r.year+'年' from table1 r,用HQL,过路的兄弟们帮帮忙啊

------解决方案--------------------
先做个table1的javabean,里有个year的字段,
然后就,select r.year from table1 r,其实和sql差不多的
------解决方案--------------------
class UserYear{
private String year;

public UserYear(){}

public UserYear(String year){
this.year = year + "年";
}
  
public void setYear(String year){
this.year = year + "年";
}

public String getYear(){
return this.year;
}
}

然后:
hql = "select new UserYear(r.year) from YourTable r ";