You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by srikaanth <sr...@snovabits.com> on 2014/03/18 05:39:28 UTC
Reg: Grid DataSources
Hi all,
Am working on a tapestry project. Am using grid to show table using
hibernate. I was able to show single table structure . But here i need
to join two table and show it in single table . Am using tapestry 5.3.
Is there any way to do or any addon avaliable or i need to created a new
structure on my own.
Reg
Srikaanth
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: Reg: Grid DataSources
Posted by Thiago H de Paula Figueiredo <th...@gmail.com>.
On Tue, 18 Mar 2014 02:50:36 -0300, Andreas Ernst <ae...@ae-online.de> wrote:
> The easiest way is to create a entity class from a sql view. Or you can
> try this:
>
> http://wiki.apache.org/tapestry/Tapestry5HowtoSelectWithObjects
Please do *not* use that (the code in that page). The approach is very bad
and I explain why in that page, so I won't repeat it here. Do the right
thing: write a ValueEncoder for your class (if it's a Hibernate entity,
tapestry-hiberate does that for you automatically) and pass it to the
Select's encoder parameter.
--
Thiago H. de Paula Figueiredo
Tapestry, Java and Hibernate consultant and developer
http://machina.com.br
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: Reg: Grid DataSources
Posted by srikaanth <sr...@snovabits.com>.
Hi Lance,
Thanks for the info i will work out as per your methods
and let u know. This methods explain me a lot. Keep going your good work.
Reg
Srikaanth .k
On Tuesday 18 March 2014 01:10 PM, Lance Java wrote:
> Another, possibly much simpler, approach is to wrap the
> HibernateGridDataSource in a ConverterGridDataSource
>
> The ConverterGridDataSource will take a GridDataSource and a Converter in
> it's constructor and it will delegate through to another GridDataSource,
> converting each row to a bean as it goes. Sounds easier / more maintainable
> that BeanModel / PropertyConduits.
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: Reg: Grid DataSources
Posted by Lance Java <la...@googlemail.com>.
Another, possibly much simpler, approach is to wrap the
HibernateGridDataSource in a ConverterGridDataSource
The ConverterGridDataSource will take a GridDataSource and a Converter in
it's constructor and it will delegate through to another GridDataSource,
converting each row to a bean as it goes. Sounds easier / more maintainable
that BeanModel / PropertyConduits.
Re: Reg: Grid DataSources
Posted by Lance Java <la...@googlemail.com>.
In hibernate, the HQL query "from Entity1 join Entity2" will return
List<Object[]> with Object[0] being Entity1 and Object[2] being Entity2.
You could use a custom BeanModel and PropertyConduits to look up properties
from the Object[] array.
See the demo here which uses a custom BeanModel and PropertyConduits to
generate a grid from a List<Map>
http://tapestry-stitch.uklance.cloudbees.net/mapgriddemo
Re: Reg: Grid DataSources
Posted by Andreas Ernst <ae...@ae-online.de>.
Am 18.03.14 05:39, schrieb srikaanth:
> Hi all,
>
> Am working on a tapestry project. Am using grid to show table using
> hibernate. I was able to show single table structure . But here i need
> to join two table and show it in single table . Am using tapestry 5.3.
> Is there any way to do or any addon avaliable or i need to created a new
> structure on my own.
The easiest way is to create a entity class from a sql view. Or you can
try this:
http://wiki.apache.org/tapestry/Tapestry5HowtoSelectWithObjects
--
ae | Andreas Ernst | IT Spektrum
Postfach 5, 65612 Beselich
Schupbacher Str. 32, 65614 Beselich, Germany
Tel: +49-6484-91002 Fax: +49-6484-91003
ae@ae-online.de | www.ae-online.de
www.tachyon-online.de
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: Reg: Grid DataSources
Posted by Thiago H de Paula Figueiredo <th...@gmail.com>.
On Tue, 18 Mar 2014 08:05:51 -0300, srikaanth
<sr...@snovabits.com> wrote:
> I have to join two table with different column name in it.
>
> eg:
>
> table_A ( id, name,age)
> table_B ( id,sex,ph)
>
> my need is this i have to show in grid like (name,age,sex,ph) in a
> single grid or table .
The join itself is a Hibernate thing so it shouldn't be described here, a
Tapestry mailing list. The Tapestry part, which is implementing a
GridDataSource, was already described. Another tip: create a class to
represent the result of the query. Your code will be more organized and
Grid will work on it easily.
--
Thiago H. de Paula Figueiredo
Tapestry, Java and Hibernate consultant and developer
http://machina.com.br
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: Reg: Grid DataSources
Posted by srikaanth <sr...@snovabits.com>.
I have to join two table with different column name in it.
eg:
table_A ( id, name,age)
table_B ( id,sex,ph)
my need is this i have to show in grid like (name,age,sex,ph) in a
single grid or table .
>> Am working on a tapestry project. Am using grid to show table using
>> hibernate. I was able to show single table structure . But here i
>> need to join two table and show it in single table . Am using
>> tapestry 5.3. Is there any way to do or any addon avaliable or i need
>> to created a new structure on my own.
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: Reg: Grid DataSources
Posted by Thiago H de Paula Figueiredo <th...@gmail.com>.
On Tue, 18 Mar 2014 01:39:28 -0300, srikaanth
<sr...@snovabits.com> wrote:
> Hi all,
Hi!
> Am working on a tapestry project. Am using grid to show table using
> hibernate. I was able to show single table structure . But here i need
> to join two table and show it in single table . Am using tapestry 5.3.
> Is there any way to do or any addon avaliable or i need to created a new
> structure on my own.
Implement your own GridDataSource and write your own Hibernate query with
the joins inside it.
--
Thiago H. de Paula Figueiredo
Tapestry, Java and Hibernate consultant and developer
http://machina.com.br
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org