关于数据表的查询和取值

shenletongxue shenletongxue 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
ssh框架,model里有Result和Count两个不同的类
public class Result {
private int day;
private int month;
public int getDay() {
return day;
}
public void setDay(int day) {
this.day = day;
}
public int getMonth() {
return month;
}
public void setMonth(int month) {
this.month = month;
}
}
public class Count {
private int id;
private String indate;
public String getIndate() {
return indate;
}
public void setIndate(String indate) {
this.indate = indate;
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
}
Dao的实现类中有如下代码:
...
List<Result> list=(List<Result>)hibernateTemplate.find("select day(indate),month(indate) from com.chart.model.Count group by day(indate)");
System.out.println(list.get(0).getDay());<==========打印不出来
...
为什么打印不出来呢?
list里面有值,是不是因为不能转换成Result类型,改怎么改呢?
...全文
评论 7
收藏 已收藏
分享
返回顶部
shenletongxue
Web 开发 81,107 成员 341,720 内容