[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
RE: [eclipselink-users] Customizable Query Result Sorter

Mohsen,

There is no special support for ordering the result beyond the ORDER BY syntax in JPQL. I would recommend writing a simple comparator that would take the same set of values and use this comparator to re-order the resulting collection after it is returned from EclipseLink.

Doug

-----Original Message-----
From: Mohsen Saboorian [mailto:mohsens@xxxxxxxxx]
Sent: Sunday, August 03, 2008 4:18 AM
To: EclipseLink User Discussions
Subject: [eclipselink-users] Customizable Query Result Sorter


Hi,

I have a JPA query with IN statement. Something like this: SELECT e
FROM Entity e WHERE e.id IN (3, 1, 2). I want to keep result order
same as the order specified in IN statement.

1. Is there any special hint to return this query in the same order as
specified in IN, i.e. row1.id = 3, row2.id = 1, row3.id = 2?
2. Is this possible to write a customized query result sorter in EclipseLink?

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