我看了这里发布的各种解决方案,但没有任何效果。
控制器
List<Company> empIds = empDao.findempbyId(Id,branch);
logger.info("Emp List:"+empIds );
Dao Layer
private static final String FIND_EMPLOYEES = "select EMP_ID from myschema.emp where id = :Id and branch = :branch";
@SuppressWarnings("unchecked")
@Transactional
public List<Company> findempbyId(String Id, String branch) {
return getSession().createSQLQuery(FIND_EMPLOYEES)
.setParameter("Id", Id)
.setParameter("branch", branch)
.list();
}
输出
Emplist : []
答案 0 :(得分:0)
试试这个
Query query = session.createSQLQuery(
"select EMP_ID from myschema.emp where EMP_ID.id = :Id ;)
.addEntity(Employee.class)
.setParameter("Id", "72");
.setParameter("branch", "branch");
List result = query.list();