package ollie.query;

import ollie.Model;
import ollie.Ollie;

import java.util.List;

public class ResultQueryBase extends ExecutableQueryBase implements ResultQuery {
	public ResultQueryBase(Query parent, Class<? extends Model> table) {
		super(parent, table);
	}

	@Override
	public <T extends Model> List<T> fetch() {
		return (List<T>) Ollie.rawQuery(mTable, getSql(), getArgs());
	}

	@Override
	public <T extends Model> T fetchSingle() {
		return (T) Ollie.rawQuery(mTable, getSql(), getArgs());
	}
}

@@ -444,17 +444,34 @@
 %7B%0A%09%09
-return (T
+List%3CT%3E results = (List%3CT%3E
 ) Ol
@@ -513,13 +513,86 @@
 rgs());%0A
+%09%09if (!results.isEmpty()) %7B%0A%09%09%09return results.get(0);%0A%09%09%7D%0A%09%09return null;%0A
 %09%7D%0A%7D%0A

Fix fetchSingle bug.