[hibernate-issues] [Hibernate-JIRA] Resolved: (HHH-1700) HAVING clause not supported in Criteria API

Diego Pires Plentz (JIRA) noreply at atlassian.com
Wed Aug 15 15:33:13 EDT 2007


     [ http://opensource.atlassian.com/projects/hibernate/browse/HHH-1700?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Diego Pires Plentz resolved HHH-1700.
-------------------------------------

      Assignee: Diego Pires Plentz
    Resolution: Duplicate

> HAVING clause not supported in Criteria API
> -------------------------------------------
>
>                 Key: HHH-1700
>                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-1700
>             Project: Hibernate3
>          Issue Type: New Feature
>          Components: query-criteria
>    Affects Versions: 3.1.3
>         Environment: Hibernate 3.1.3, Oracle 10g (not DB specific)
>            Reporter: Manuel Dominguez Sarmiento
>            Assignee: Diego Pires Plentz
>            Priority: Minor
>         Attachments: CustomProjections.java
>
>   Original Estimate: 2 hours
>  Remaining Estimate: 2 hours
>
> Currently the Criteria API does not support the HAVING clause.  I have create a factory class which creates Projection instances using sqlGroupProjection.  Probably not the best approach, but an idea which could be further developed.  These factory methods could be included in the Projections factory class.
> Usage example w/one property:
> criteria.setProjection(CustomProjections.groupByHaving("id", Hibernate.LONG, "count(distinct id) >= 3"));
> Also allows aliases:
> criteria.setProjection(CustomProjections.groupByHaving("id", "idAlias", Hibernate.LONG, "count(distinct idAlias) >= 3"));
> Usage example w/many properties:
> String[] columns = new String[2];
> columns[0] = "id";
> columns[1] = "name";
> String[] aliases = new String[2];
> aliases[0] = "idAlias";
> aliases[1] = "nameAlias";
> Type[] types = new Type[2];
> types[0] = Hibernate.LONG;
> types[1] = Hibernate.STRING;
> criteria.setProjection(CustomProjections.groupByHaving(columns, aliases, types, "count(distinct id) >= 3 and name='george'"));

-- 
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