[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
Re: [eclipselink-users] Best way to support case insensitive alphanumeric sorting..
|
EclipseLink provides toUpperCase() and toLowerCase() expressions and JPA
provides UPPER and LOWER operators. For queries I expect you could use those
operators in the ORDER BY part of your query to sort.
If you are talking about a mapping, you could use an EclipseLink
DescriptorCustomizer to add ordering by an EclipseLink expression to the
selection query. Roughly:
OneToManyMapping oneToManyMapping =
(OneToOneMapping)descriptor.getMappingForAttributeName("attributeName");
ExpressionBuilder builder =
oneToManyMapping.getSelectionQuery().getExpressionBuilder();
Expression orderExpression = builder.get("postalCode").toLowerCase().ascending();
oneToManyMapping.getSelectionQuery().addOrdering(orderExpression);
-Tom
On 05/06/2013 11:54 AM, vaidya nathan wrote:
Hi,
What is the best way to support case insensitive alphanumeric sorting using jpa2
and eclipselink ? An example of what i would like to achieve is to sort on
something similiar to the canada zips which could be alphanumeric..
We are using Eclipselinks ReadAllQuery and Expression language to build our
queries and the queries that we have so far is like this..
SELECT * FROM
(SELECT a.*, ROWNUM rnum FROM
(SELECT DISTINCT t1.ID AS a1,<colname>
FROM <Table> ORDER BY t0.<colname> ASC) a WHERE ROWNUM <= ?) WHERE rnum > ?
)a
Thx
_______________________________________________
eclipselink-users mailing list
eclipselink-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/eclipselink-users