postgresql - Criteria Query saying wrong type (Postgres operator does not exist) -


i have query in want employees not have empid, usrid, , empidentifier in action table of db (the 3 form foreign key in action table).

    criteriabuilder cb = entitymanager.getcriteriabuilder();     criteriaquery<emp> q = cb.createquery(emp.class);     root<emp> c = q.from(emp.class);      list<predicate> predicates = new arraylist<predicate>();      subquery<action> sq = q.subquery(action.class);     root<action> ac = sq.from(action.class);      sq.select(ac);     sq.where(cb.equal(ac.get("actioncd"), "close"));      predicates.add(c.get("empid").in(sq).not());     predicates.add(c.get("usrid").in(sq).not());     predicates.add(c.get("empidentifier").in(sq).not());      ....      q.where(predicates.toarray(new predicate[]{})); 

when execute query following error:

 org.postgresql.util.psqlexception: error: operator not exist: text = numeric   hint: no operator matches given name , argument type(s). might need add explicit type casts. 

empid , usrid both numeric fields in db, empidentifier text. if have empid , userid or empidentifier predicates query works fine, need 3 together. seems can query numeric values or text values , not 2 together.

how can around this? postgres or jpa issue? have double , triple checked db , classes , have appropriate types. reason thinks empidentifier numeric value or comparing against numeric value instead of text is.

edit:

sql query log:

from emps."emp" emp0_   (emp0_."empid" not in  (select action1_."actionid" emps."action" action1_  action1_."actioncd"=?))   ,   (emp0_."usrid" not in  (select action2_."actionid" emps."action" action2_  action2_."actioncd"=?))   ,   (emp0_."empidentifier" not in  (select action3_."actionid" emps."action"  action3_ action3_."actioncd"=?))  


Comments

Popular posts from this blog

Is there a better way to structure post methods in Class Based Views -

performance - Why is XCHG reg, reg a 3 micro-op instruction on modern Intel architectures? -

jquery - Responsive Navbar with Sub Navbar -