Almost brilliant! Except that if I have to write my own transformer or
the bean from scratch, it's still more lines of code than just writing
the getters for the template. There's no way to suppress the
properties you've aliased (right?) but maybe I'll just use
aliasToBean() and create a "DisplayableBean" that inherits from
original - that way I only need to write get/set for the property I'm
using in the orderBy and keep the template as is.

Kalle


On Wed, Aug 26, 2009 at 11:18 PM, Igor
Drobiazko<igor.drobia...@gmail.com> wrote:
> You can set a ResultTransformer to your criteria.
>
> https://www.hibernate.org/hib_docs/v3/api/org/hibernate/transform/ResultTransformer.html
>
> On Thu, Aug 27, 2009 at 8:06 AM, Kalle Korhonen
> <kalle.o.korho...@gmail.com>wrote:
>
>> I'm using tapestry-hibernate and I have a case where I'm forced to use
>> Projections (or aggregate functions in hql but same end result) so my
>> query is returning an object array. Now, I'm rendering a list of that
>> information to the user, but since using ${obj[0]} expansion is not
>> supported, I'm forced to write a getter for each synthetic property
>> (so I can refer to them with ${objProp1}, ${objProp2} etc.) I'm
>> displaying in my grid. It's not too bad, but is there a better way to
>> do this? (could do it with ognl, but I would like to avoid adding a
>> new dependency just for this).
>>
>> Kalle
>>
>> PS. Bonus points if you tell me how to make Hibernate return objects
>> with Criteria api if I only need projections for ordering the result
>> set.
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
>> For additional commands, e-mail: users-h...@tapestry.apache.org
>>
>>
>
>
> --
> Best regards,
>
> Igor Drobiazko
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org

Reply via email to