I can't seem to find a way of listing and ordering the bean.
my edit of the xmanagertemplate.vm
I commented out the whole // 38.5 and wrapped the current loadAll into loadAllOrderBy
----------
public $beanClass[] loadAll(int startRow, int numRows) throws SQLException
{
return loadAllOrderBy(null, startRow, numRows);
}
public $beanClass[] loadAllOrderBy(String orderField, int startRow, int numRows) throws SQLException
{
Connection c = null;
PreparedStatement ps = null;
// check if any ordering by needs to be done
StringBuffer _sql = new StringBuffer("SELECT " + ALL_FIELDS + " FROM $tablename");
if (orderField != null)
{
_sql.append(" ORDER BY " + orderField);
}
I can't seem to find a way of listing and ordering the bean.
my edit of the xmanagertemplate.vm
I commented out the whole // 38.5 and wrapped the current loadAll into loadAllOrderBy
----------
public $beanClass[] loadAll(int startRow, int numRows) throws SQLException
{
return loadAllOrderBy(null, startRow, numRows);
}
public $beanClass[] loadAllOrderBy(String orderField, int startRow, int numRows) throws SQLException
{
Connection c = null;
PreparedStatement ps = null;
// check if any ordering by needs to be done
StringBuffer _sql = new StringBuffer("SELECT " + ALL_FIELDS + " FROM $tablename");
if (orderField != null)
{
_sql.append(" ORDER BY " + orderField);
}
try
{
c = getConnection();
ps = c.prepareStatement(_sql.toString(),ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY);
// tcy edit
return loadByPreparedStatement(ps, null, startRow, numRows);
}
finally
{
getManager().close(ps);
freeConnection(c);
}
}
> can't seem to find a way of listing and ordering the bean.
the trick is to use loadByWhere methods... and pass for example "ORDER BY LASTNAME" as a 'where' argument...
N.