« Return to Thread: Expression for all lineitems that where picked today

Expression for all lineitems that where picked today

by philk :: Rate this Message:

Reply to Author | View in Thread

Hello,

I am struggling constructing my EL expression for the following:
"Select the first lineitem that was picked today"

final ExpressionBuilder eb = new ExpressionBuilder();
eb.get("pickedAt").greaterThanEqual(eb.addDate("day", 0)).and(eb.lessThan(eb.addDate("day", 1)))
                        .minimum();
ReadObjectQuery query = new ReadObjectQuery(LegacyOrderPosition.class);
query.setSelectionCriteria(eb);
final Object first = JpaHelper.createQuery(query, em).getSingleResult();

But this will not return me the expected entity, but rather some random entity that does not even have the "pickedAt" member set (its null).

How would I compose that query and how could I use the database provided DATE() method rather than the to give the date from the client using "new Date()".

Regards,
Phil

_______________________________________________
eclipselink-users mailing list
eclipselink-users@...
https://dev.eclipse.org/mailman/listinfo/eclipselink-users

 « Return to Thread: Expression for all lineitems that where picked today