MySQLDataTruncation: en Dehors de la plage de la valeur de la colonne

Je suis l'insertion d'une ligne à l'aide de ibatis et java webapp. Le POJO a un domaine qui a besoin de stocker un nombre (comme 3.0 ou 2,34). J'ai essayé d'utiliser BigDecimal et Double sur le java côté. Sur la base de la partie, je suis l'aide d'une Virgule(5, 5) type de données.

Lorsque j'essaie d'insérer une ligne qui a de la "4" comme valeur pour ce champ numérique, MySQL et iBatis jeter l'exception suivante:

org.springframework.jdbc.UncategorizedSQLException: SqlMapClient operation: encountered SQLException [  
--- The error occurred in org/mySQL.xml.  
--- The error occurred while applying a result map.  
--- Check the mySQL.insertQuery.  
--- The error happened while setting a property on the result object.  
--- Cause: java.lang.RuntimeException: org.springframework.jdbc.UncategorizedSQLException: SqlMapClient operation: encountered SQLException [  
--- The error occurred while applying a parameter map.  
--- Check the insertQuery-InlineParameterMap.  
--- Check the statement (update failed).  
--- Cause: com.mysql.jdbc.MysqlDataTruncation: Data truncation: Out of range value for column 'numericColumn' at row 316]; nested exception is com.ibatis.common.jdbc.exception.NestedSQLException:   
at com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.executeQueryWithCallback(GeneralStatement.java:188)
at com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.executeQueryWithRowHandler(GeneralStatement.java:133)
at com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryWithRowHandler(SqlMapExecutorDelegate.java:649)
at com.ibatis.sqlmap.engine.impl.SqlMapSessionImpl.queryWithRowHandler(SqlMapSessionImpl.java:156)
at com.ibatis.sqlmap.engine.impl.SqlMapClientImpl.queryWithRowHandler(SqlMapClientImpl.java:133)
at org.springframework.orm.ibatis.SqlMapClientTemplate$5.doInSqlMapClient(SqlMapClientTemplate.java:267)
at org.springframework.orm.ibatis.SqlMapClientTemplate.execute(SqlMapClientTemplate.java:165)
at org.springframework.orm.ibatis.SqlMapClientTemplate.queryWithRowHandler(SqlMapClientTemplate.java:265)
at org.myClass(myClass.java:83)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at org.springframework.util.MethodInvoker.invoke(MethodInvoker.java:248)
at org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean$MethodInvokingJob.executeInternal(MethodInvokingJobDetailFactoryBean.java:165)
at org.springframework.scheduling.quartz.QuartzJobBean.execute(QuartzJobBean.java:66)
at org.quartz.core.JobRunShell.run(JobRunShell.java:191)
at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:516)

Suis-je utiliser le mauvais java type de données de la valeur à insérer? Si non, pourquoi ne pas en MySQL permettez-moi d'insérer la valeur?

OriginalL'auteur David | 2012-08-21