Thursday, January 5, 2012

Hibernate annotation Exception

1. Caused by: java.sql.SQLException: Fail to convert to internal representation

Reason: Datatype is mismatched between DB and Pojo class variable

Solution: Make sure the DB column datatype to map correctly with Pojo class variable datatype and other reason is when fk relation between the column is not with PK id then also we get the same error

2. org.springframework.jdbc.UncategorizedSQLException: Hibernate flushing: could not insert: SQL state [null]; error code [17070]; Data size bigger than max size for this type: 18628; nested exception is java.sql.SQLException: Data size bigger than max size for this type: 18628

Reason: If the column in table does not have foreign key relation ship and in mapping POJO class if the column defined as other POJO class as datatype then we will get this error

3. error code [17026]; Numeric Overflow; nested exception is java.sql.SQLException: Numeric Overflow

Reason: If the DB column having the data more than 10 character, and fetching that column with Integer variable in POJO will lead to this Exception

Solution: When Integer variable is using in POJO make sure that the column value does not exceed 10 characters

No comments:

Post a Comment