text: ~
security: ~
fixes:
+ - Fixed order by descending on primitives (issue-21)
- Fixed setting null column values (issue-22)
- Fixed Postgres 9.5 Upsert syntax (issue-23)
changes: ~
return this;
}
+ public Query<T> orderByDesc(byte field) {
+ return orderByDescPrimitive(field);
+ }
+
+ public Query<T> orderByDesc(short field) {
+ return orderByDescPrimitive(field);
+ }
+
+ public Query<T> orderByDesc(int field) {
+ return orderByDescPrimitive(field);
+ }
+
+ public Query<T> orderByDesc(long field) {
+ return orderByDescPrimitive(field);
+ }
+
+ public Query<T> orderByDesc(float field) {
+ return orderByDescPrimitive(field);
+ }
+
+ public Query<T> orderByDesc(double field) {
+ return orderByDescPrimitive(field);
+ }
+
+ Query<T> orderByDescPrimitive(Object field) {
+ Object alias = getPrimitiveAliasByValue(field);
+ if (alias == null) {
+ return orderByDesc(field);
+ }
+ return orderByDesc(alias);
+ }
+
public Query<T> orderByDesc(Object expr) {
OrderExpression<T> e = new OrderExpression<T>(this, expr, true, false, false);
addOrderBy(e);
.orderByDesc(SupportedTypes.SAMPLE.id)
.selectDistinct(SupportedTypes.SAMPLE.id);
assertEquals(10, ids.size());
- assertEquals("[9, 8, 7, 6, 5, 4, 3, 2, 1, 0]", ids.toString());
+ assertEquals("[10, 9, 8, 7, 6, 5, 4, 3, 2, 1]", ids.toString());
}
}
\r
// insert random models in reverse order\r
List<PrimitivesModel> models = PrimitivesModel.getList();\r
- PrimitivesModel model = models.get(0);\r
Collections.reverse(models);\r
// insert them in reverse order\r
db.insertAll(models);\r
\r
PrimitivesModel p = new PrimitivesModel();\r
- List<Long> list = db.from(p)/*.orderByDesc(p.myLong)*/.select(p.myLong);\r
+ List<Long> list = db.from(p).orderByDesc(p.myLong).select(p.myLong);\r
assertEquals(models.size(), list.size());\r
- assertEquals("[1, 2, 3, 4, 5, 6, 7, 8, 9, 10]", list.toString());\r
+ assertEquals("[10, 9, 8, 7, 6, 5, 4, 3, 2, 1]", list.toString());\r
}\r
}\r