« Return to Thread: Criteria Query How-To

Criteria Query How-To

by Randall Schulz :: Rate this Message:

Reply to Author | View in Thread

Hi,

I would like to perform the equivalent of this SQL query, which works as
desired precisely as shown here against the actual database created by
GORM from my domain class:


mysql> select distinct resident_folder from job;
+-----------------+
| resident_folder |
+-----------------+
| /rrs            |
| /rrs/PSL        |
+-----------------+
2 rows in set (0.01 sec)


In particular, I cannot seem to make the projections { ... } node work.
Here is the method I defined in an attempt to replicate the foregoing
query:

    public          \
    static          \
    folderNames()
    {
        return Clif.createCriteria().listDistinct {
            fetchMode('residentFolder', FM.EAGER)
            projections { 'residentFolder' }
            order('residentFolder', 'asc')
        }
    }


This variant produces precisely the same results:

    public          \
    static          \
    folderNames()
    {
        return Clif.createCriteria().list {
            fetchMode('residentFolder', FM.EAGER)
            projections { distinct('residentFolder') }
            order('residentFolder', 'asc')
        }
    }



Randall Schulz

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


 « Return to Thread: Criteria Query How-To