sql??hql换成 from [实体类名] 试哈
解决方案 »
- struts1.3+hibernate3.0+spring3.0做查询怎么报错,急
- 关于颜色渐变效果有些不明白,请各位大侠赐教.
- 初学者百分求助小小问题,,,
- 请问哪位知道struts中使text标签不可编辑的属性??
- 求大牛指点。在线等结果——————跪求
- 初学者问题 求一个 完整的 java 读写 xml文件 的代码 在线等待
- 用jboss做服务器.访问时要求输入网络密码.怎么解决掉??????
- 运行在不同Tomcat上的两个应用如何实现一次登陆和统一权限?
- 设计模式能解决这样的问题吗?
- nginx长连接问题,客户端和服务端要保持长连接,在通过nginx后长连接没办法保持,求解决方法
- java中如何把set转为list?
- 有人用过SVF吗?
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd" >
<hibernate-mapping>
<!--
Created by the Middlegen Hibernate plugin 2.2 http://boss.bekk.no/boss/middlegen/
http://www.hibernate.org/
--><class
name="model.VomAccountEatList"
table="vom_account_eat_list"
lazy="false"
>
<id
name="gameId"
column="game_id"
type="long"
length="19"
/>
<property
name="gameDatetime"
column="game_datetime"
type="java.sql.Timestamp"
length="23"
/>
<property
name="gameType"
column="game_type"
type="int"
length="3"
/>
<property
name="gameid"
column="gameid"
type="long"
length="19"
/>
<property
name="gameDate"
column="game_date"
type="java.lang.String"
length="10"
/>
<property
name="objectid"
column="objectid"
type="java.lang.String"
length="80"
/>
<property
name="gameObjectid"
column="game_objectid"
type="java.lang.String"
length="80"
/>
<property
name="eatNumber"
column="eat_number"
type="int"
length="10"
/>
<property
name="amount"
column="amount"
type="java.math.BigDecimal"
length="18"
/>
<property
name="eatAmount"
column="eat_amount"
type="java.math.BigDecimal"
length="18"
/>
<property
name="modifyDatetime"
column="modify_datetime"
type="java.sql.Timestamp"
length="23"
/>
<property
name="modifyUsername"
column="modify_username"
type="java.lang.String"
length="23"
/>
<property
name="recDatetime"
column="rec_datetime"
type="java.sql.Timestamp"
length="23"
/>
<!-- Associations -->
<!-- derived association(s) for compound key -->
<!-- end of derived association(s) -->
</class>
</hibernate-mapping>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd" >
<hibernate-mapping>
<!--
Created by the Middlegen Hibernate plugin 2.2 http://boss.bekk.no/boss/middlegen/
http://www.hibernate.org/
--><class
name="model.VomAccountEatList"
table="vom_account_eat_list"
lazy="false"
>
<id
name="gameId"
column="game_id"
type="long"
length="19"
/>
<property
name="gameDatetime"
column="game_datetime"
type="java.sql.Timestamp"
length="23"
/>
<property
name="gameType"
column="game_type"
type="int"
length="3"
/>
<property
name="gameid"
column="gameid"
type="long"
length="19"
/>
<property
name="gameDate"
column="game_date"
type="java.lang.String"
length="10"
/>
<property
name="objectid"
column="objectid"
type="java.lang.String"
length="80"
/>
<property
name="gameObjectid"
column="game_objectid"
type="java.lang.String"
length="80"
/>
<property
name="eatNumber"
column="eat_number"
type="int"
length="10"
/>
<property
name="amount"
column="amount"
type="java.math.BigDecimal"
length="18"
/>
<property
name="eatAmount"
column="eat_amount"
type="java.math.BigDecimal"
length="18"
/>
<property
name="modifyDatetime"
column="modify_datetime"
type="java.sql.Timestamp"
length="23"
/>
<property
name="modifyUsername"
column="modify_username"
type="java.lang.String"
length="23"
/>
<property
name="recDatetime"
column="rec_datetime"
type="java.sql.Timestamp"
length="23"
/>
<!-- Associations -->
<!-- derived association(s) for compound key -->
<!-- end of derived association(s) -->
</class>
</hibernate-mapping>
这个好像有问题吧
hql = select from user 不要 "*"
query.list(); 我想看看你的查询结果是怎么输出来的
你的原因可能是list结果集中指针没有下移你可以这样试试
Iterator it = query.list().iterator();
while(it!=null&&it.hasNext()){
User user = (User)it.next();
System.out.println("user:"+user.???);
}
建议用yinyuejin的方法将数据库的记录一条一条打印出来看看
Query q = session.createQuery(hql);
List list = q.list();//后台打印出来一条sql语句为select ....(所有列) from VomAccountEatList
return list;list不是指针没有下移,确实是里面的数据都是同一条,因为我在断点跟踪(debug)的时候看过.我用后台那条sql去数据库执行是正常的,还是怀疑配置文件的问题,大家再探讨一下