有关hibernate原生sql查询 - Java / Java EE
我的表为:testtable
字段为:id int not,name decimal(10,2);
插入的测试数据为:
1,10.2
SQLQuery query = con.createSQLQuery("select * from testtable");
List products = query.list();
报错如下:
2010-5-20 15:18:17 org.apache.catalina.core.StandardWrapperValve invoke
严重: Servlet.service() for servlet action threw exception
java.lang.ArithmeticException: Rounding necessary
at java.math.BigDecimal.divide(BigDecimal.java:1346)
at java.math.BigDecimal.setScale(BigDecimal.java:2310)
at org.hibernate.type.BigIntegerType.get(BigIntegerType.java:35)
at org.hibernate.type.NullableType.nullSafeGet(NullableType.java:163)
at org.hibernate.type.NullableType.nullSafeGet(NullableType.java:189)
at org.hibernate.loader.custom.CustomLoader$ScalarResultColumnProcessor.extract(CustomLoader.java:474)
at org.hibernate.loader.custom.CustomLoader$ResultRowProcessor.buildResultRow(CustomLoader.java:420)
at org.hibernate.loader.custom.CustomLoader.getResultColumnOrRow(CustomLoader.java:317)
at org.hibernate.loader.Loader.getRowfromResultSet(Loader.java:606)
at org.hibernate.loader.Loader.doQuery(Loader.java:701)
at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:236)
at org.hibernate.loader.Loader.doList(Loader.java:2213)
at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2104)
at org.hibernate.loader.Loader.list(Loader.java:
相关问答:
字段1,字段2.....字段N,Status,ParentID
1,Name1....test1,1,99
1,Name1....test1,3,99
1,Name2....test2,1,101
1,Name2....test2,3,101
1,Name3....test3,2,101
1,Name1....test1,4,101
想要的结果是:
1,Na ......
我是个新手,望高手解答
我现在已经安装了mysql,也有mysql的jdbc。但我怎么配置后,才能在MyEclipse里操作mysql呢?请高手说详细点
打开Myeclipse----window---open perspective---MyEclipse database explorer-- ......
使用java在windows7 32位下连接MSSQL。
两台机器,windows7 32位,在控制面板里面全部设置语言和区域选项都english-unitedstates
唯一区别只有在安装SQL server 2008的时候 选择的字符集不一样,
exec sp_helpsor ......
id name datetime
1 a 2010-05-13 10:15:00
2 b 2010-05-14 09:10:00
3 d 2010-05-14 10:10:00
如何将距离目前最近的那个记录的name 更新为“x”呢
谢谢咯 啊 呵呵
update table_n ......
现在不想用<a> </a> 标签 ,因为点击后会出现页面重定位,给文字加上css样式就可以看起来 是href怎么实现这样的css
text-decoration:underline; cursor:hand;
引用
text-decoration:underline; cur ......