Announcement Announcement Module
Collapse
No announcement yet.
Attempt was made to get data value of type '<UNKNOWN>'from datavalue of type 'BIGINT' Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Attempt was made to get data value of type '<UNKNOWN>'from datavalue of type 'BIGINT'

    Hi,
    I am executing a select query on Derby DB using SimpleJdbcTemplate and i get the following exception.

    but when i execute the sql statement by directly fetching connection and creating statements , it executes correctly.

    Could you guys please help me out here

    Code:

    Code:
    public class JdbcPimDAO extends SimpleJdbcDaoSupport{
    
    	private static final Log log = LogFactory.getLog(JdbcPimDAO.class);
    	
    	//TODO update the method and query based on business requirements
    	public void fetchProductOfferings(){
    		Map params = new HashMap();
    		params.put("USER_ID", "543");	
    		
    		List resultList = getSimpleJdbcTemplate().queryForList("select empid from EMPLOYEES E where E.USER_ID = ?", params);		
    		
    		if(log.isDebugEnabled()) log.debug("Result returned for fetchProductOfferings :" + resultList);
    		
    	}
    }

    Exception:
    org.springframework.dao.DataIntegrityViolationExce ption: PreparedStatementCallback; SQL [select empid from EMPLOYEES E where E.USER_ID = ?]; An attempt was made to get a data value of type '<UNKNOWN>' from a data value of type 'BIGINT'.; nested exception is java.sql.SQLDataException: An attempt was made to get a data value of type '<UNKNOWN>' from a data value of type 'BIGINT'.
    at org.springframework.jdbc.support.SQLErrorCodeSQLEx ceptionTranslator.doTranslate(SQLErrorCodeSQLExcep tionTranslator.java:228)
    at org.springframework.jdbc.support.AbstractFallbackS QLExceptionTranslator.translate(AbstractFallbackSQ LExceptionTranslator.java:72)
    at org.springframework.jdbc.core.JdbcTemplate.execute (JdbcTemplate.java:607)
    at org.springframework.jdbc.core.JdbcTemplate.query(J dbcTemplate.java:641)
    at org.springframework.jdbc.core.JdbcTemplate.query(J dbcTemplate.java:666)
    at org.springframework.jdbc.core.JdbcTemplate.query(J dbcTemplate.java:698)
    at org.springframework.jdbc.core.namedparam.NamedPara meterJdbcTemplate.query(NamedParameterJdbcTemplate .java:133)
    at org.springframework.jdbc.core.namedparam.NamedPara meterJdbcTemplate.queryForList(NamedParameterJdbcT emplate.java:197)
    at org.springframework.jdbc.core.namedparam.NamedPara meterJdbcTemplate.queryForList(NamedParameterJdbcT emplate.java:201)
    at org.springframework.jdbc.core.simple.SimpleJdbcTem plate.queryForList(SimpleJdbcTemplate.java:212)
    at com.nike.batch.ips.dao.JdbcPimDAO.fetchProductOffe rings(JdbcPimDAO.java:20)
    at com.nike.tests.DBCPConnectionTest.testSpringJdbc(D BCPConnectionTest.java:42)
    at com.nike.tests.DBCPConnectionTest.main(DBCPConnect ionTest.java:36)
    Caused by: java.sql.SQLDataException: An attempt was made to get a data value of type '<UNKNOWN>' from a data value of type 'BIGINT'.
    at org.apache.derby.client.am.SQLExceptionFactory40.g etSQLException(Unknown Source)
    at org.apache.derby.client.am.SqlException.getSQLExce ption(Unknown Source)
    at org.apache.derby.client.am.PreparedStatement.setNu ll(Unknown Source)
    at org.apache.commons.dbcp.DelegatingPreparedStatemen t.setNull(DelegatingPreparedStatement.java:108)
    at org.apache.commons.dbcp.DelegatingPreparedStatemen t.setNull(DelegatingPreparedStatement.java:108)
    at org.springframework.jdbc.core.StatementCreatorUtil s.setNull(StatementCreatorUtils.java:254)
    at org.springframework.jdbc.core.StatementCreatorUtil s.setParameterValueInternal(StatementCreatorUtils. java:214)
    at org.springframework.jdbc.core.StatementCreatorUtil s.setParameterValue(StatementCreatorUtils.java:128 )
    at org.springframework.jdbc.core.PreparedStatementCre atorFactory$PreparedStatementCreatorImpl.setValues (PreparedStatementCreatorFactory.java:301)
    at org.springframework.jdbc.core.PreparedStatementCre atorFactory$PreparedStatementCreatorImpl.createPre paredStatement(PreparedStatementCreatorFactory.jav a:252)
    at org.springframework.jdbc.core.JdbcTemplate.execute (JdbcTemplate.java:585)
    ... 10 more
    Caused by: org.apache.derby.client.am.SqlException: An attempt was made to get a data value of type '<UNKNOWN>' from a data value of type 'BIGINT'.
    at
    org.apache.derby.client.am.PreparedStatement$Possi bleTypes.throw22005Exception(Unknown Source)
    ... 19 more
Working...
X