Why is JPA throwing SQLCODE=-302, SQLSTATE=22001 for select query

时间:2017-06-15 09:23:56

标签: sql spring db2 spring-data-jpa db2-luw

I'm trying to frame a select query using JPA repository.

select * 
from Foo 
where name = 'testapp'.

The "NAME" column is defined as varchar(4). My program throws SQLCODE=-302, SQLSTATE=22001 for the select operation whereas I get the same query working in the SQL developer IDE.

1 个答案:

答案 0 :(得分:0)

那很奇怪!您是如何获得数据的?testapp'插入到表格的名称列中。如果将其定义为VARCHAR(4),则首先不能插入超过4个字节的内容。你确定它是VARCHAR(4)吗?