关于hibernate取值问题,跪求高手帮帮忙

java 专栏收录该内容
12 篇文章 0 订阅
[b][size=medium]异常:[/size][/b]org.hibernate.exception.GenericJDBCException: could not execute query
at org.hibernate.exception.SQLStateConverter.handledNonSpecificException(SQLStateConverter.java:103)
at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:91)
at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
at org.hibernate.loader.Loader.doList(Loader.java:2223)
at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2104)
at org.hibernate.loader.Loader.list(Loader.java:2099)
at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:378)
at org.hibernate.hql.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:338)
at org.hibernate.engine.query.HQLQueryPlan.performList(HQLQueryPlan.java:172)
at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1121)
at org.hibernate.impl.QueryImpl.list(QueryImpl.java:79)
at com.asia.grandbuy.dao.impl.UpdateDateTimeImpl.getDate(UpdateDateTimeImpl.java:37)
at com.asia.grandbuy.update.UpdateAllServer.run(UpdateAllServer.java:401)
at java.util.TimerThread.mainLoop(Timer.java:512)
at java.util.TimerThread.run(Timer.java:462)
Caused by: java.sql.SQLException: database locked
at org.sqlite.DB.execute(DB.java:270)
at org.sqlite.PrepStmt.executeQuery(PrepStmt.java:67)
at org.hibernate.jdbc.AbstractBatcher.getResultSet(AbstractBatcher.java:186)
at org.hibernate.loader.Loader.getResultSet(Loader.java:1787)
at org.hibernate.loader.Loader.doQuery(Loader.java:674)
at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:236)
at org.hibernate.loader.Loader.doList(Loader.java:2220)
... 11 more
15:10:00,234 [ Timer-0:12063 ] ERROR UpdateDateTimeImpl:43 - org.hibernate.exception.GenericJDBCException: could not execute query
[size=medium][b]UpdateAllServer出错的地方[/b][/size]
public void run(){
String atime = uptime.getDate(300);
Client.sendCommand(300,atime,new CallbackObject() {
public void invoke(Object arg0) {
..........
}
String atime = uptime.getDate(301);
Client.sendCommand(301,atime,new CallbackObject() {
public void invoke(Object arg0) {
..........
}
String atime = uptime.getDate(302);[color=darkred]//抛异常地方[/color]
Client.sendCommand(302,atime,new CallbackObject() {
public void invoke(Object arg0) {
..........
}

String atime = uptime.getDate(303);
Client.sendCommand(303,atime,new CallbackObject() {
public void invoke(Object arg0) {
..........
}
}
[size=medium][b]查询语句:[/b][/size]
public String getDate(int command) {
List<UpdateDateTime> list = new ArrayList<UpdateDateTime>();
String dateString= "2010-02-02 13:13:13";
try {
beginTransaction();
Query q = session.createQuery("from UpdateDateTime ud where ud.command=?").setParameter(0, command);
if(q != null){
list = q.list();
dateString = list.get(0).getDatetime();
}
endTransaction(false);
} catch (HibernateException e) {
e.printStackTrace();
log.error(e);
return dateString;
}
return dateString;
}

[size=medium][b]hbm.xml[/b][/size]
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping package="com.asia.grandbuy.pojo">
<class name="UpdateDateTime" table="update_datetime_tb">
<id column="ud_id" name="id" type="java.lang.Integer">
<generator class="native"></generator>
</id>
<property column="ud_Command" name="command" type="java.lang.Integer"/>
<property column="ud_time" name="datetime" type="java.lang.String"/>
</class>
</hibernate-mapping>

奇怪了,300,301,303这几个地方取值都没有问题,就302有,跪求高手们来点思路...
  • 1
    点赞
  • 0
    评论
  • 0
    收藏
  • 扫一扫,分享海报

©️2022 CSDN 皮肤主题:大白 设计师:CSDN官方博客 返回首页
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、C币套餐、付费专栏及课程。

余额充值