lundi 18 juillet 2016

Hibernate returning empty list even though the values are available in the table

I looked various solutions posted here but nothing worked.

Controller

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();
}

Output

Emplist : []

Aucun commentaire:

Enregistrer un commentaire