This content has been marked as final.
Show 1 reply
-
1. Re: Problem with a query
jamesjmp May 25, 2009 6:51 PM (in response to bryan_1983)If you use an EntityQuery subclass, you must assign the string with the query to ejbql member, and if you have parameters define them in restrictions member.
When you invoke your EntityQuery subclass component's getResultList two things happens:
1.- the query to be executed is the one that Ejbql provides
2.- restrictions are taken into account
3.- query is executed and its result returnedFor example (Seam 2.1.1):
private static final String EJBQL = "select settlementInstruction from SettlementInstruction settlementInstruction"; private static final String[] RESTRICTIONS = { "lower(settlementInstruction.orderType) like concat(lower(#{settlementInstructionList.settlementInstruction.orderType}),'%')", }; private SettlementInstruction settlementInstruction = new SettlementInstruction(); public SettlementInstructionList() { setEjbql(EJBQL); setRestrictionExpressionStrings(Arrays.asList(RESTRICTIONS)); setMaxResults(25); } public SettlementInstruction getSettlementInstruction() { return settlementInstruction; }