Select select = new Select();
ElementSymbol a = new ElementSymbol("a"); //$NON-NLS-1$
select.addSymbol(a);
Criteria crit1 = new CompareCriteria(new ElementSymbol("b"), CompareCriteria.EQ, new ElementSymbol("x")); //$NON-NLS-1$ //$NON-NLS-2$
Expression constant = new Constant(new Integer(1000));
Criteria crit2 = new CompareCriteria(a, CompareCriteria.EQ, constant);
Criteria crit = new CompoundCriteria(CompoundCriteria.AND, crit1, crit2);
Query query = new Query();
query.setSelect(select);
query.setFrom(from);
query.setCriteria(crit);