Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/jpa/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 返回大小类型错误的命名JPA查询_Java_Jpa_Integer_Long Integer_Return Type - Fatal编程技术网

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 ...
来解决这个任务。现在很好用