db-torque-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "wzhao6898@gmail.com" <wzhao6...@gmail.com>
Subject How to strip off selected columns from a criteria object
Date Wed, 05 May 2010 21:28:43 GMT
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.

I understand that criteria is essentially a HashTable, but only WHERE
clause
(through criteria.add(...) ) has a key in criteria, I can't find join and
column
key information from the criteria.keySet()?

BTW, how do I re-construct a criteria by putting all the pieces in criteria
together? I don't want to use criteria.clone() in this case.
Thanks in advance!

David

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message