Hi Richard,

Internally JPAGridDataSource does not handle sorting itself, instead it
delegates it to JPA and transient values are unknown to JPA. If you want to
handle transient values, you will have to write you own implementation of
GridDataSource where in you can retrieve all the rows from the database and
based on the SortConstraints passed to prepare() method, sort the values
yourself.

regards
Taha

On Tue, Jul 12, 2011 at 4:58 AM, Richard Yunhua Sang
<yunhua.s...@gmail.com>wrote:

> Thanks for your reply, but I do want to sort the result by transient field
> in Grid. It would be appreciated that the JPAGridDataSource is able to sort
> the result within JVM.
>
> On Mon, Jul 11, 2011 at 5:29 PM, Thiago H. de Paula Figueiredo <
> thiag...@gmail.com> wrote:
>
> > On Mon, 11 Jul 2011 18:06:17 -0300, Richard Yunhua Sang <
> > yunhua.s...@gmail.com> wrote:
> >
> >  Hi there,
> >>
> >
> > Hi!
> >
> >
> >  I am using a Grid with JpaGridDataSource; when I click sort icon on a
> >> transient field of an entity, I get following exception:
> >>
> >
> > I don't think any GridDataSource implementation backed by a database
> would
> > be able to handle transient properties, so you should set their
> > corresponding PropertyModel's as unsortable. To get the PropertyModel,
> > create a BeanModel for you entity class using the BeanModelSource service
> > and use its get() method.
> >
> > --
> > Thiago H. de Paula Figueiredo
> > Independent Java, Apache Tapestry 5 and Hibernate consultant, developer,
> > and instructor
> > Owner, Ars Machina Tecnologia da Informação Ltda.
> > http://www.arsmachina.com.br
> >
>

Reply via email to