Hello.
It would be nice if anybody could show me how to use setRestrictions method whitch belongs to the EntityQuery object from the org.jboss.seam.framework.EntityQuery package.
I have tried to use it this way:
...
import org.jboss.seam.framework.EntityQuery;
import org.jboss.seam.core.Expressions.ValueExpression;
public class LetterList extends EntityQuery<Letter>
{
public LetterList()
{
setEjbql("select letter from Letter letter");
}
public void sampleMethod(){
List<ValueExpression> restrictions = new ArrayList<ValueExpression>();
restrictions.add(createValueExpression("letter.id=7"));
setRestrictions(restrictions);
}
}
However, this piece of code throws an exception.
The following lines lead to error too:
String[] RESTRICTIONS = {"letter.id=7"};
setRestrictionExpressionStrings(Arrays.asList(RESTRICTIONS));
It is also interesting if it is possible to pass any parameters the nice way while using setEjbql. I mean whether it is possible to avoid concatenation.
I have really tried to find some examples of relevant code, but in vain. So, I would highly appreciate a few lines of code that work.