From d5a74dcac41eeb96a656b7033e43d51b92f75d18 Mon Sep 17 00:00:00 2001 From: James Moger Date: Mon, 8 Aug 2011 12:03:10 -0400 Subject: Fixed first enum constant special case. (issue 4) --- src/com/iciql/Query.java | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src') diff --git a/src/com/iciql/Query.java b/src/com/iciql/Query.java index 2d31e8d..2e58fe5 100644 --- a/src/com/iciql/Query.java +++ b/src/com/iciql/Query.java @@ -359,6 +359,15 @@ public class Query { token.appendSQL(stat, this); return; } + if (alias != null && value.getClass().isEnum()) { + // special case: + // value is first enum constant which is also the alias object. + // the first enum constant is used as the alias because we can not + // instantiate an enum reflectively. + stat.appendSQL("?"); + addParameter(stat, alias, value); + return; + } SelectColumn col = aliasMap.get(value); if (col != null) { col.appendSQL(stat); -- cgit v1.2.3