Native query setParameter difference

67 views Asked by At

Query query = em.createNativeQuery("SELECT * FROM IS_CON \n" + "WHERE CONNUMBER=?1 AND REV=?2", IsCon.class).setParameter(1, con).setParameter(2, rev); is query return null.

But this query works.

Query query = em.createNativeQuery("SELECT * FROM IS_CON \n" + "WHERE CONNUMBER='"+con+"' AND REV='"+rev+"'", IsCon.class);

What is wrong my code? I think my code has nothing wrong.

0

There are 0 answers