Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [eclipselink-users] What am I missing?

Hi,
  Please use JPQL queries and void the native query. EclipsLink with
translate them to ReadAllQuery automatically (magic will happen)

 If you hit a rock then only use ReadAllQuery/ReadObjectQuery

Regards,
Gaurav Malhotra


testit wrote:
> 
> The following query always returns all the rows.  When criteria is not
> null then departmentId has an int value.  It is like I have never set the
> expression but I see it under debug.  What is the deal?  
> 
> public List<Employee> getEmployees( Employee criteria, int page,
>         int limit ) throws Exception
> {
>     ReadAllQuery query = new ReadAllQuery(Employee.class);
>     ExpressionBuilder eb = query.getExpressionBuilder();
>     query.addAscendingOrdering ("lastName");
>     query.addAscendingOrdering ("firstName");
>     if(criteria != null)
>     {
>         eb.get("departmentId").equal( criteria.getDepartmentId() );
>     }
>     query.setSelectionCriteria(eb);
>     query.refreshIdentityMapResult();
>     List employees = (List) session.executeQuery(query);
>     return employees;
> }
> 

-- 
View this message in context: http://www.nabble.com/What-am-I-missing--tp20544738p20560374.html
Sent from the EclipseLink - Users mailing list archive at Nabble.com.



Back to the top