Getting column index out of range, 0 < 1

Posted by Natraj on Stack Overflow See other posts from Stack Overflow or by Natraj
Published on 2012-07-04T15:12:17Z Indexed on 2012/07/04 15:15 UTC
Read the original article Hit count: 255

Filed under:

I am using OpenJPA 2.2.0 and when I am executing a select statement I am getting "Column index out of range, 0 < 1" error.

EntityManager entityMgrObj = emf.getEntityManager();

entityMgrObj.clear();

Query query = entityMgrObj.createNativeQuery("select * from company_user where user_id = 1001);

List<CompanyUserDO> companyUserDOObj = null;

try {
    companyUserDOObj = query.getResultList();
} catch (Exception e) {
    System.out.println(e.getMessage());
}

When the query.getResultList() executes I get "Column index out of range, 0 < 1" error. Can somebody let me know what is wrong in the above code?

© Stack Overflow or respective owner

Related posts about openjpa