@@ -47,7 +47,6 @@ public class QueryBuilder<T> {
4747 public static boolean LOG_VALUES ;
4848
4949 private StringBuilder orderBuilder ;
50- private StringBuilder tableBuilder ;
5150 private StringBuilder joinBuilder ;
5251
5352 private final List <WhereCondition > whereConditions ;
@@ -134,18 +133,21 @@ protected void checkCondition(WhereCondition whereCondition) {
134133 }
135134 }
136135
136+ /** Not supported yet. */
137137 public <J > QueryBuilder <J > join (Class <J > entityClass , Property toOneProperty ) {
138138 throw new UnsupportedOperationException ();
139139 // return new QueryBuilder<J>();
140140 }
141141
142+ /** Not supported yet. */
142143 public <J > QueryBuilder <J > joinToMany (Class <J > entityClass , Property toManyProperty ) {
143144 throw new UnsupportedOperationException ();
144145 // @SuppressWarnings("unchecked")
145146 // AbstractDao<J, ?> joinDao = (AbstractDao<J, ?>) dao.getSession().getDao(entityClass);
146147 // return new QueryBuilder<J>(joinDao, "TX");
147148 }
148149
150+ /** Adds the given properties to the ORDER BY section using ascending order. */
149151 public QueryBuilder <T > orderAsc (Property ... properties ) {
150152 for (Property property : properties ) {
151153 checkOrderBuilder ();
@@ -154,6 +156,7 @@ public QueryBuilder<T> orderAsc(Property... properties) {
154156 return this ;
155157 }
156158
159+ /** Adds the given properties to the ORDER BY section using descending order. */
157160 public QueryBuilder <T > orderDesc (Property ... properties ) {
158161 for (Property property : properties ) {
159162 checkOrderBuilder ();
@@ -162,6 +165,16 @@ public QueryBuilder<T> orderDesc(Property... properties) {
162165 return this ;
163166 }
164167
168+ /**
169+ * Adds the given raw SQL string to the ORDER BY section. Do not use this for standard properties: ordedAsc and
170+ * orderDesc are prefered.
171+ */
172+ public QueryBuilder <T > orderRaw (String rawOrder ) {
173+ checkOrderBuilder ();
174+ orderBuilder .append (rawOrder );
175+ return this ;
176+ }
177+
165178 protected StringBuilder append (StringBuilder builder , Property property ) {
166179 checkProperty (property );
167180 builder .append (tablePrefix ).append ('.' ).append (property .columnName );
@@ -184,6 +197,10 @@ protected void checkProperty(Property property) {
184197 }
185198 }
186199
200+ /**
201+ * Builds a reusable query object (Query objects can be executed more efficiently than creating a QueryBuilder for
202+ * each execution.
203+ */
187204 public Query <T > build () {
188205 String select ;
189206 if (joinBuilder == null || joinBuilder .length () == 0 ) {
0 commit comments