criteria - Jpa QueryBuilder Multiple expressions in where clause not working -


i having issue creating queries javax.persistence.criteria.criteriabuilder. using eclipselink 2.1 , oracle 10g database. when building query multiple restrictions use first restriction, not both of them.

here code:

criteriabuilder cb = getem().getcriteriabuilder(); criteriaquery<assignment> query = cb.createquery(assignment.class); root<assignment> assignment = query.from(assignment.class);  query.where(     cb.equal(assignment.get("request"), request),     cb.isnull(assignment.get("enddate")));  return getem().createquery(query).getresultlist(); 

the query producted is:

select assx_id, end_date, begin_date, comments,         assx_oer_assigned_to_id, oer_oer_id_assigned_by,         assx_rqst_id  tarts.assignment_xref  (assx_rqst_id = ?) 

it looks except clause. expecting:

select assx_id, end_date, begin_date, comments,         assx_oer_assigned_to_id, oer_oer_id_assigned_by,         assx_rqst_id tarts.assignment_xref  (assx_rqst_id = ? , begin_date not null) 

it doesn't matter if use cb.and(arg1, arg2) or not also. doing wrong? appreciated.

your query looks ok. you've mentioned, criteriaquery.where(predicate... restrictions) uses conjunction of predicates there's no need use cb.and().

the things imagine:

  • bug in eclipselink (try same hibernate)
  • some sort of optimization, maybe enddate may never null?
  • your getem() method strange things

Comments

Popular posts from this blog

c++ - Is it possible to compile a VST on linux? -

java - Output of Eclipse is rubbish -

jquery - Confused with JSON data and normal data in Django ajax request -