I have the following two classes, where the Document extends an Abstract class that provides helper functions, one of which is a "find" method that builds queries to find records based on some simple logic.
public abstract class AbstractTable<T extends AbstractTable<T>> extends Model {
...
public T find (String[] columns) {
String whereClause = "";
List<Object> whereClauseData = new ArrayList<Object> ();
for (String column : columns) {
Object data = this.get(column);
if (data == null) {
whereClause += column + " is null AND ";
} else {
whereClause += column + " = ? AND ";
whereClauseData.add (data);
}
}
return findFirst (whereClause.substring(0, whereClause.length () - 5), whereClauseData.toArray());
}
}
public class Document extends AbstractTable<Document> {
...
public Document findExistingObject(Document document) {
String[] columns = new String[] {"court_case_id", "number", "name", "file_date"};
return super.find (columns);
}
}
When I run this code, and the "findExistingObject" method is called on a Document, I receive this exception:
Exception in thread "main" org.javalite.activejdbc.InitException: failed to determine Model class name, are you sure models have been instrumented?
I've made completely sure that I've instrumented the classes. When I move the code from AbstractTable into Document, everything works perfectly. I'm hoping someone can lend some advice, or help, that might show me what I'm doing wrong.
Thanks in advance.