On Wednesday, February 20, 2002, at 05:03  PM, Kevin Rutherford wrote:

> Actually, it appears that there is a better way to solve this issue. The
> TurbineSecurity service calls the underlying DBUserManager class to do 
> the
> query. DBUserManager walks through the Criteria object and automatically
> adds the table name to the columns that don't already have a table name,
> which is why using User.XXXX works for the WHERE clause stuff. It just
> doesn't do this for any sorting specifications.

I looked at DBUserManager to see how to add the table name so the ORDER 
BY
clauses will work correctly.  But a variety of messy problem in Criteria
and DBUserManager would make this a *very* ugly hack -- which is probably
why it's not already there.

I patched DBUserManager earlier this week so that it will throw a more
meaningful error message when this happens.  It'll tell you that the
column name is malformed instead of "String index out of range: -1".

If you get that error message in your log file, here's the solution:
Use the constants from TurbineUserPeer.  Like this:

   Criteria crit2 = new Criteria();
   crit2.addAscendingOrderByColumn(TurbineUserPeer.USERNAME);
   User[] UserList = TurbineSecurity.getUsers(crit2);

Don't use the constants in User nor in UserPeer.  Use TurbineUserPeer.


This is an exception to the typical way Peers are usually used with
Criteria.  But that's probably how it's going to be until someone finds
time to overhaul Criteria or the SecurityService.

-Eric

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to