Re: Grid data source, BeanModel and nested properties

2015-01-06 Thread Ilya Obshadko
Actually the solution was @Formula Hibernate fields. For example: @XmlTransient @Formula("(select sum(invoices.amountdue) from invoices where invoices.event_id = event_id and invoices.participant_id = participant_id)") private Double amountInvoiced; PostgreSQL is able to optimize i

Re: Grid data source, BeanModel and nested properties

2015-01-06 Thread Jonathan Barker
Ilya, I haven't faced that situation… yet. I guess the complication is in specifying the grouping conditions. My stats listings are restricted in size, so I don't worry about a paged grid source for those, and I get the results from stored procedures. Some of the *counts* in that list are large

Re: Grid data source, BeanModel and nested properties

2015-01-05 Thread Ilya Obshadko
I have ended up with custom DTO classes and Hibernate projections. Although the resulting code looks far from elegant, it's extremely fast, compared to 'normal' retrieval using lists, without paging (especially for lists with hundreds of records of course). On Mon, Jan 5, 2015 at 1:39 PM, Thiago H

Re: Grid data source, BeanModel and nested properties

2015-01-05 Thread Thiago H de Paula Figueiredo
On Fri, 02 Jan 2015 06:45:30 -0200, Ilya Obshadko wrote: I'm trying to implement a Grid data source optimized for database retrievals (with paging support). Basically it's derived from HibernateGridDataSource from Tapestry distribution, and provides support for complex Criteria queries: https

Re: Grid data source, BeanModel and nested properties

2015-01-03 Thread Ilya Obshadko
Johnathan, How do you handle situations when several of the properties you need to display are aggregates? For example: select ..., sum(amount_invoiced), sum(amount_paid) from orders group by order_id. This won't work nice with Projections.rowCount() (unless you use sub-select, which might be sub

Re: Grid data source, BeanModel and nested properties

2015-01-02 Thread Jonathan Barker
Ilya, Our strategy is to use a class specifically to hold the query results, so the sort criteria are simple properties. The Criteria query and Projection are supplied separately to our GridDataSource. The Projection maps any child properties onto aliases (useful for the sorting), and an option

Re: Grid data source, BeanModel and nested properties

2015-01-02 Thread Chris Poulsen
The automatic creation of bean models can only do so much - I always find that the automatic model creation is great for getting started, but at some point it is always necessary to provide explicit bean models. The pattern we end up with is something like this: model = beanModelSource.createDisp

Grid data source, BeanModel and nested properties

2015-01-02 Thread Ilya Obshadko
I'm trying to implement a Grid data source optimized for database retrievals (with paging support). Basically it's derived from HibernateGridDataSource from Tapestry distribution, and provides support for complex Criteria queries: https://gist.github.com/xfyre/ecb36a9173aed6a37f14 However, there i