[hibernate-issues] [Hibernate-JIRA] Commented: (HHH-4113) Support for case when ... then ... else ... end when using projections

Dobes Vandermeer (JIRA) noreply at atlassian.com
Tue Sep 1 15:19:15 EDT 2009


    [ http://opensource.atlassian.com/projects/hibernate/browse/HHH-4113?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=33880#action_33880 ] 

Dobes Vandermeer commented on HHH-4113:
---------------------------------------

Hi Gail,

I'm just using my application's test suites, I didn't make any standalone suite yet.  Sorry about that ...





> Support for case when ... then ... else ... end when using projections
> ----------------------------------------------------------------------
>
>                 Key: HHH-4113
>                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-4113
>             Project: Hibernate Core
>          Issue Type: New Feature
>    Affects Versions: 3.3.2
>            Reporter: Dobes Vandermeer
>         Attachments: CaseWhenProjection.java, ConstantProjection.java
>
>
> I have a colleciton of queries that are mostly the same except for one part of the condition, and I decided to convert them to using the criteria API so I didn't have to copy/paste the entire text of the query all over the place.  The only missing features were:
> 1. Support for case when ... then ... else ... end in the select clauses/projections
> 2. Support for constants in the projections
> So, I added them.
> There are a couple hacks in there that could be eliminated if you were willing to change the guts of the criteria system a little bit - particularly to allow projections to add '?' values to the SQL query and to make it easier to tell a projection not to emit as "as" clause.  These changes would support other compound projections such as negation, add, subtract, divide.  Why not support expressions like "sum(case when x then -y else z end)" ... ?
> I thought I'd share these to benefit anyone else out there who might run into the same issue, or to serve as an example to work from if the hibernate contributors are interested in incorporating this into the core.

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