Gordon Ramsay
Gordon Ramsay

Reputation: 11

EntityQuery restrictions in JBoss Seam

Is it possible to create restriction clauses for the Seam EntityQuery, that are ORed instead of always being ANDed together?

Upvotes: 1

Views: 1782

Answers (2)

Simon Lebettre
Simon Lebettre

Reputation: 1

Be aware you can also write everything in the private static final String EJBQL ,EL is interpreted here too, so you can combine OR and AND like this :

select c from Cat c where c.gender=#{cat.gender} and ( c.name=#{cat.name} or c.color=#{cat.color} )

You can even avoid problems with null values like this : where c.name=#{empty cat.name ? "defaultName" : cat.name }

Upvotes: 0

Petar Minchev
Petar Minchev

Reputation: 47373

Take a look at setRestrictionLogicOperator(operator). Operator can be "and" or "or". This will "and" or "or" all restriction statements.

Upvotes: 1

Related Questions