Hi Thomas, Thanks for your reply. But what I need to deal with is that: I have a criteria object, with joins, and where clauses and a list of columns to select, and I need to remove all the selected columns in the criteria, both selected column, and as columns, so I can use OMPeer class to select a list of OM objects; Thanks again!
David On Thu, May 6, 2010 at 8:39 AM, Thomas Vandahl <t...@apache.org> wrote: > On 05.05.10 23:28, wzhao6...@gmail.com wrote: > > Hi there, > > > > I need to strip off all the selected columns (getSelectedColumns(), and > > getAsColumns()) from a criteria object, is there a way for me to do that? > > For examples: > > Criteria criteria = new Criteria(); > > > criteria.addJoin(PermissionPeer.PERMISSION_ID,RolePermissionPeer.PERMISSION_ID); > > criteria.addJoin(RolePermissionPeer.ROLE_ID, RolePeer.ROLE_ID); > > criteria.add(PermissionPeer.PERMISSION_ID, 1, Criteria.EQUAL) > > criteria.addSelectColumn(PermissionPeer.PERMISSION_ID); > > criteria.addAsColumn("permission", PermissionPeer.PERMISSION_ID); > > criteria.setDistinct(); > > > > where, I'd like to remove the selected columns: > > PermissionPeer.PERMISSION_ID,, but > > criteria.remove(PermissionPeer.PERMISSION_ID); > > doesn't do it for me. > > Several databases require all columns used in the where-clause to be in > the list of selected columns, too. Furthermore, the Peer classes expect > all columns needed for the construction of the OM object to be present > in the result set. If you use BasePeer.doSelect, however, you can build > any criteria you want. You will get back Village records, though. > > Bye, Thomas. > > --------------------------------------------------------------------- > To unsubscribe, e-mail: torque-user-unsubscr...@db.apache.org > For additional commands, e-mail: torque-user-h...@db.apache.org > >