发帖    主题    评论    推荐    标签    作者    订阅    查搜    注册   登陆   关注
 
面向对象 设计模式 领域驱动设计 企业架构 框架 开发教程 微服务 大数据 扩展性 并发编程 事件驱动 分布式 SOA

hibernate查询错误

2005-07-20 17:49
赞助商链接

兄弟刚用Hibernate,现在遇到问题,请大家帮忙分析一下原因:
类:
public String getSysTime(String strFormat) throws HibernateException {
net.sf.hibernate.Session sessionT4 = null;
String strSysTime = new String("");
FMJF01TDAO.initialize();
FMJF01TDAO dao01 = new FMJF01TDAO();
sessionT4 = dao01.createNewSession();
StringBuffer strBufSql = new StringBuffer(); strBufSql.append("select distinct to_char(sysdate,'yy') as systime from fmjf01t ");
net.sf.hibernate.Query query = sessionT4.createQuery(strBufSql.toString());
ScrollableResults sc = query.scroll();
if (sc.next()) {
System.out.println("data exist");
}

return "yes";
}

Exception:
net.sf.hibernate.QueryException: , expected in SELECT [select distinct to_char(sysdate,'yy') as systime from fmjf01t ]
at net.sf.hibernate.hql.SelectParser.token(SelectParser.java:169)
at net.sf.hibernate.hql.ClauseParser.token(ClauseParser.java:87)
at net.sf.hibernate.hql.ClauseParser.end(ClauseParser.java:114)
at net.sf.hibernate.hql.PreprocessingParser.end(PreprocessingParser.java:143)
at net.sf.hibernate.hql.ParserHelper.parse(ParserHelper.java:30)
at net.sf.hibernate.hql.QueryTranslator.compile(QueryTranslator.java:149)
at net.sf.hibernate.hql.QueryTranslator.compile(QueryTranslator.java:138)
at net.sf.hibernate.impl.SessionFactoryImpl.getQuery(SessionFactoryImpl.java:295)
at net.sf.hibernate.impl.SessionImpl.scroll(SessionImpl.java:1646)
at net.sf.hibernate.impl.QueryImpl.scroll(QueryImpl.java:33)
at jp.co.melco.monoris.FDC.util.FMJF11C.getSysTime(FMJF11C.java:91)
at jp.co.melco.monoris.FDC.util.FMJF11C.chkYear(FMJF11C.java:668)
at jp.co.melco.monoris.FDC.util.FMJF11C.main(FMJF11C.java:914)

2005-07-20 23:06

net.sf.hibernate.exception.GenericJDBCException: Could not execute query
at net.sf.hibernate.exception.ErrorCodeConverter.handledNonSpecificException(ErrorCodeConverter.java:90)
at net.sf.hibernate.exception.ErrorCodeConverter.convert(ErrorCodeConverter.java:79)
at net.sf.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:30)
at net.sf.hibernate.impl.SessionImpl.convert(SessionImpl.java:4110)
at net.sf.hibernate.impl.SessionImpl.find(SessionImpl.java:1556)
at net.sf.hibernate.impl.QueryImpl.list(QueryImpl.java:39)
at jp.co.melco.monoris.FDC.util.FMJF11C.getSysTime(FMJF11C.java:111)
at jp.co.melco.monoris.FDC.util.FMJF11C.main(FMJF11C.java:1070)
Caused by: java.sql.SQLException:数值的溢出
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:124)
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:161)
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:226)
at oracle.jdbc.driver.NumberCommonAccessor.throwOverflow(NumberCommonAccessor.java:6796)
at oracle.jdbc.driver.NumberCommonAccessor.getInt(NumberCommonAccessor.java:105)
at oracle.jdbc.driver.OracleResultSetImpl.getInt(OracleResultSetImpl.java:489)
at oracle.jdbc.driver.OracleResultSet.getInt(OracleResultSet.java:1604)
at net.sf.hibernate.type.IntegerType.get(IntegerType.java:21)
at net.sf.hibernate.type.NullableType.nullSafeGet(NullableType.java:62)
at net.sf.hibernate.type.NullableType.nullSafeGet(NullableType.java:53)
at net.sf.hibernate.type.AbstractType.hydrate(AbstractType.java:66)
at net.sf.hibernate.loader.Loader.hydrate(Loader.java:686)
at net.sf.hibernate.loader.Loader.loadFromResultSet(Loader.java:627)
at net.sf.hibernate.loader.Loader.instanceNotYetLoaded(Loader.java:586)
at net.sf.hibernate.loader.Loader.getRow(Loader.java:501)
at net.sf.hibernate.loader.Loader.getRowFromResultSet(Loader.java:213)
at net.sf.hibernate.loader.Loader.doQuery(Loader.java:281)
at net.sf.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:133)
at net.sf.hibernate.loader.Loader.doList(Loader.java:1033)
at net.sf.hibernate.loader.Loader.list(Loader.java:1024)
at net.sf.hibernate.hql.QueryTranslator.list(QueryTranslator.java:854)
at net.sf.hibernate.impl.SessionImpl.find(SessionImpl.java:1553)
... 3 more

2005-07-20 23:08

什么原因造成数值溢出的
是否表中数据查询字段过多引起的
我用几个字段的表进行查询就没有问题
请斑竹帮忙回答,谢谢!

赞助商链接

赞助商链接

返回顶部

移动版 关于本站 使用帮助 联系管理员 最佳分辨率1366x768
OpenSource JIVEJDON Powered by JdonFramework Code © 2002-20 jdon.com