Error java.sql.SQLException: Numeric Overflow when Connect to Oracle using Hibernate

Got weird error today, here is the complere stacktrace

2018-01-31 12:14:56 WARN  SqlException: - SQL Error: 17026, SQLState: 99999
2018-01-31 12:14:56 ERROR SqlException: - Numeric Overflow

Caused by: java.sql.SQLException: Numeric Overflow
	at oracle.jdbc.driver.NumberCommonAccessor.throwOverflow(NumberCommonAccessor.java:4136)
	at oracle.jdbc.driver.NumberCommonAccessor.getInt(NumberCommonAccessor.java:103)
	at oracle.jdbc.driver.GeneratedStatement.getInt(GeneratedStatement.java:197)
	at oracle.jdbc.driver.GeneratedScrollableResultSet.getInt(GeneratedScrollableResultSet.java:244)
	at oracle.jdbc.driver.GeneratedResultSet.getInt(GeneratedResultSet.java:554)
	at org.apache.tomcat.dbcp.dbcp.DelegatingResultSet.getInt(DelegatingResultSet.java:275)
	at org.apache.tomcat.dbcp.dbcp.DelegatingResultSet.getInt(DelegatingResultSet.java:275)
	at org.hibernate.type.descriptor.sql.IntegerTypeDescriptor$2.doExtract(IntegerTypeDescriptor.java:66)
	at org.hibernate.type.descriptor.sql.BasicExtractor.extract(BasicExtractor.java:64)
	at org.hibernate.type.AbstractStandardBasicType.nullSafeGet(AbstractStandardBasicType.java:265)
	at org.hibernate.type.AbstractStandardBasicType.nullSafeGet(AbstractStandardBasicType.java:261)
	at org.hibernate.type.AbstractStandardBasicType.nullSafeGet(AbstractStandardBasicType.java:251)
	at org.hibernate.type.AbstractStandardBasicType.hydrate(AbstractStandardBasicType.java:336)
	at org.hibernate.persister.entity.AbstractEntityPersister.hydrate(AbstractEntityPersister.java:2924)
	at org.hibernate.loader.Loader.loadFromResultSet(Loader.java:1695)
	at org.hibernate.loader.Loader.instanceNotYetLoaded(Loader.java:1627)
	at org.hibernate.loader.Loader.getRow(Loader.java:1509)
	at org.hibernate.loader.Loader.getRowFromResultSet(Loader.java:719)
	at org.hibernate.loader.Loader.processResultSet(Loader.java:949)
	at org.hibernate.loader.Loader.doQuery(Loader.java:917)
	at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:348)
	at org.hibernate.loader.Loader.doList(Loader.java:2550)
	... 75 more	

And here is my java class,

public class Class {
   private Integer value;

   // other setter and getter
}

How to solve the issue is actually quite simple, it’s all happen because im having a data on database which is bigger than Integer’s max value. Updating my bean from Integer to BigDecimal solve the problem,

public class Class {
   private BigDecimal value;

   // other setter and getter
}
Google+

No Comments

Leave a Comment

Please be polite. We appreciate that.
Your email address will not be published and required fields are marked


:-[ (B) (^) (P) (@) (O) (D) :-S ;-( (C) (&) :-$ (E) (~) (K) (I) (L) (8) :-O (T) (G) (F) :-( (H) :-) (*) :-D (N) (Y) :-P (U) (W) ;-)