[hibernate-issues] [Hibernate-JIRA] Commented: (HHH-3468) SQLFunction Criterion/Projection
joel winteregg (JIRA)
noreply at atlassian.com
Tue Sep 9 04:28:04 EDT 2008
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-3468?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=31108#action_31108 ]
joel winteregg commented on HHH-3468:
-------------------------------------
SqlFunctionProjection cannot be used into a Projections.groupProperty() because a property is needed ;-) If an alias is created using:
Projections.projectionList()
.add(Projections.alias(new SqlFunctionProjection("date_trunc", "startDate", "hour"), "myalias"))
It is not possible to use it as follow: .add(Projections.groupProperty("myalias")) because groupProperty cannot find the created alias
org.hibernate.QueryException: could not resolve property: myalias of: ...
Because groupProperty() method add the needed SQL statement into the SELECT statement and into the GROUP BY statement, no alias should be created. Maybe a new method like groupFunction() should be provided ?
For now, the following code works well, but it does not use defined function from SQL dialect:
.add(Projections.sqlGroupProjection("date_trunc('hour', startDate) as x", "x", new String[] { "x" }, new Type[] { Hibernate.STRING }))
> SQLFunction Criterion/Projection
> --------------------------------
>
> Key: HHH-3468
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-3468
> Project: Hibernate3
> Issue Type: New Feature
> Components: query-criteria
> Reporter: Steve Ebersole
> Assignee: Steve Ebersole
> Fix For: 3.2.x, 3.3.x, 3.4
>
> Attachments: SqlFunctionProjection.java
>
>
> write Projection and Criterion impl to utilize SQLFunctions registered with the Dialect.
--
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