oracle-databasehibernatejpacreatequery

Parameter value [100] did not match expected type [java.time.LocalDateTime (n/a)]


I am facing weird problem in one query

select * from sbill.act_sub_t where (act_sub_t.unsub_dt - 
act_sub_t.sub_dt) < 100;

Using this query i am getting result in oracle sql developer tool but facing below issue with java.

 Parameter value [100] did not match expected type 
 [java.time.LocalDateTime (n/a)]

Below is the java code

  Query query1 = entityManager.createQuery("select * from ActSubT 
  where (ActSubT.unsub_dt - ActSubT.sub_dt) <:days").setParameter("days", 
   100);

Solution

  • Can you try with TO_DATE()

    select * from sbill.act_sub_t 
    where (TO_DATE(act_sub_t.unsub_dt, 'YYYY-MM-DD') - TO_DATE(act_sub_t.sub_dt, 'YYYY-MM-DD')) < 100;