1

I am trying to create a DetachedCriteria query using an or. It workds fine with createCriteria but here the or is being replaced by an and. Any ideas why? Is that a bug. The fact that a and b are defined as closure is a simplified version of what I ultimately need.

a= { eq ('name', 'east') }
b= { eq ('name', 'west') }
q=new DetachedCriteria (Property)  .build { projections { property 'name' } }
q.or (a)
q.or (b)

q.list()

gives this query:

Hibernate: select this_.name as y0_ from property this_ where (this_.name=?) **and** (this_.name=?)

Notice the and in the where condition. I am trying to get an or. Any help appreciated

Thanks

Pascal

Pascal DeMilly
  • 681
  • 1
  • 6
  • 16
  • I've had my issues with where clauses and detachedCriteria. I think there are a few bugs. Best to use createCriteria or HQL where needed if detachedCriteria is not working out for you. – Jim Sosa Sep 23 '13 at 21:24

0 Answers0