我在 Seam 2.2.2.Final 中遇到 EntityQuery 的问题,我不能在 EJBQL 中使用“新”运算符,
“从 Perst prest 中选择新的 com.ej.Prest(prest.id, prest.name)”
有人解决了这个问题吗?
我在 Seam 2.2.2.Final 中遇到 EntityQuery 的问题,我不能在 EJBQL 中使用“新”运算符,
“从 Perst prest 中选择新的 com.ej.Prest(prest.id, prest.name)”
有人解决了这个问题吗?
如果com.ej.Prest是 JPA 实体,则不需要使用new,只需查询即可:
select p from Prest p
甚至:
from Prest
如果它不是 JPA 实体,那么您不能在from子句中使用它,您只需要在那里使用 JPA 实体。例如,您可以这样做(在此示例中,MyEntity是一个 JPA 实体,其构造函数中使用了name和surname属性Prest:
select new com.ej.Prest(me.name, me.surname) from MyEntity me
此外,您需要使用正确的参数定义构造函数,在本例中为com.ej.Prest:
public Prest(String name, String surname) {
// constructor code here
}