[hibernate-issues] [Hibernate-JIRA] Created: (HHH-3188) Criteria: expose whether restrictions have been added

Paul Benedict (JIRA) noreply at atlassian.com
Mon Mar 17 13:38:33 EDT 2008


Criteria: expose whether restrictions have been added
-----------------------------------------------------

                 Key: HHH-3188
                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-3188
             Project: Hibernate3
          Issue Type: Improvement
          Components: query-criteria
    Affects Versions: 3.3
            Reporter: Paul Benedict


Creating a criteria with no restrictions queries all instances. That's expected and fine. However, I see a lot of business services which will translate a search DTO into a Criteria instance, and there's no clean way of determining when the criteria actually has restrictions attached. Example:

Criteria crit = ...createCriteria(...);

if (dto.getComponent2() != null) {
 // translate properties
} 

if (dto.getComponent2() != null) {
 // translate properties
}

if (crit.isRestricted() {  // Proposal
  // do real search
} else {
  return;
}

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        



More information about the hibernate-issues mailing list