#13 Util.getQueryVariableColumnList() returns null

open
nobody
None
5
2003-04-05
2003-04-05
Kenneth Stout
No

There are cases where getQueryVariableColumnList() does
not qualify any of the columns defined in the xml.
(i.e. no '?' in any of the field-conditions, or the
query field-name is not a bean column name). In these
cases a null is returned instead of an empy list. This
results in a number of issues:
1) in struts-action.vm and dao.vm it uses the previous
query's field-name list. Velosity is not clearing the
list on null.
2) no jsp query/*.jsp file is created.

In my case I was attempting to create a query using a
field that is not part of the bean which would have
allowed me to simply update the DAO's sql syntax with a
join to accomplish the query. This would have allowed
Karapan Sapi to do most of my work generating
everything needed and also avoided all of the overhead
of adding a entire bean to obtain the single query.

Updating getQueryVariableColumnList() return area to
the following fixes by problem.

Column[] vars = new Column[index];
if(index > 0) {
System.arraycopy(temp, 0, vars, 0, index);
}
return vars;

However, I would think that using a field-name that is
not a valid column in the bean should be generating an
error.

Discussion