Hi!
I would like to ask if this is on a todo list to support something like
select sum(cast(colxxx as numeric)) from table
with the criteria api.
Today its not possible as all the projection/expression/etc only use
"String" for the property name.
What I would propose will break the current criteria-api (the internal
interfaces) and thus I would like to ask before I start to look in every
detail.
What needs to be done:
Intorduce a new interface e.g. "Fragment". This might have only one method
Fragment.toSqlString(Criteria criteria, CriteriaQuery criteriaQuery)
Then, instead of using "String propertyName" all around use "Fragment
fragment".
A fragment can then be a "PropertyFragment" (which allows to access
columns) or e.g. a "FunctionFragment"
Where Hibernate uses "criteriaQuery.getColumn(" in one of the
Projections (and maybe other places too) use fragment.toSqlString(...)
This should then allow something like:
crit.setProjection(Projections.avg(Functions.cast("value", "numeric"));
What do you think? Will such a patch be accepted?
---
Mario
-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO
September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
_______________________________________________
hibernate-devel mailing list
hibernate-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/hibernate-devel