[英]Hibernate criteria query using Projections.rowCount() causes a numeric overflow
I'm using Oracle 11g R2. 我正在使用Oracle 11g R2。 I have a table with 9.1 billion rows.
我的表有91亿行。 When I try to run a criteria query which contains
Projections.rowCount()
(which I need to do to get the number of rows in the table) using either .list()
or .uniqueResult()
, I get a Numeric Overflow exception. 当我尝试使用
.list()
或.uniqueResult()
运行包含Projections.rowCount()
(需要获取表中的行数Projections.rowCount()
的条件查询时,出现了Numeric Overflow异常。
The relevant part of the stack trace: 堆栈跟踪的相关部分:
java.sql.SQLException: Numeric Overflow
oracle.jdbc.driver.NumberCommonAcessor?throwOverFlow
oracle.jdbc.driver.NumberCommonAcessor?getInt
oracle.jdbc.driver.OracleResultSetImpl?getInt
oracle.jdbc.driver.OracleResultSet?getInt
org.hibernate.type.IntegerType?get <---------------- oops.
org.hibernate.type.NullableType?nullSafeGet
org.hibernate.type.NullableType?nullSafeGet
org.hibernate.loader.criteria.CriteriaLoader?getResultColumnOrRow
org.hibernate.loader.Loader.getRowFromResultSet
org.hibernate.loader.Loader.doQuery
org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections
org.hibernate.loader.Loader.doList
org.hibernate.loader.Loader.listIgnoreQueryCache
org.hibernate.loader.Loader.list
org.hibernate.loader.criteria.CriteriaLoader?list
org.hibernate.impl.SessionImpl?.list
org.hibernate.impl.CriteriaImpl?.list
mypackage.myclass.GetRowCount
Hibernate is deciding to use an Integer to store the result regardless of the table size. Hibernate决定使用Integer来存储结果,而不管表的大小如何。 How can I override this behaviour?
我该如何忽略这种行为?
使用SQLProjection ,其返回Type
足够大以适合您的结果。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.