Java 返回大小类型错误的命名JPA查询
我有以下疑问:Java 返回大小类型错误的命名JPA查询,java,jpa,integer,long-integer,return-type,Java,Jpa,Integer,Long Integer,Return Type,我有以下疑问: select lect from Lecturer lect where lect.lectures.size > :minNr 测试中的这一行填入minNr的值: query.setParameter("minNr", 2L); 我的问题是,我总是收到以下错误消息: java.lang.IllegalArgumentException: Parameter value [2] did not match expected type [java.lang.Integer
select lect from Lecturer lect
where lect.lectures.size > :minNr
测试中的这一行填入minNr的值:
query.setParameter("minNr", 2L);
我的问题是,我总是收到以下错误消息:
java.lang.IllegalArgumentException: Parameter value [2] did not match expected type [java.lang.Integer]
如果我将上述测试行更改为
query.setParameter("minNr", 2);
没问题。但我不能改变考试,因为这是一项任务
有没有办法将规模回归到长期?
或者count是否返回Long类型的值
希望你能理解我的问题
问候我用过
Select count(distinct lecture) FROM Lecture join ...
来解决这个任务。现在很好用