我想传递常数值,如下所示:请帮助
我正在使用EntityManager在JPA Query中传递常量值("成功")。
例如: -
Query query = em.createQuery("SELECT a.alertId ,a.vmdId,"Successful") from Alertstatus a where a.alertId = ? and a.vmdId = ?");
答案 0 :(得分:0)
尝试设置如下参数:
Query query = em.createQuery("SELECT a.alertId ,a.vmdId, :parameter) from
Alertstatus a where a.alertId = ? and a.vmdId = ?")
.setParameter("parameter", "Successful");