-
1. Re: Which component for a sortable list?
pmuir Mar 12, 2008 11:04 AM (in response to wachtda.scsi.gmx.ch)I would use EntityQuery.
-
2. Re: Which component for a sortable list?
wachtda.scsi.gmx.ch Mar 12, 2008 11:29 AM (in response to wachtda.scsi.gmx.ch)Hello Pete
I not very pleased with EntityQuery because they have to be created all at a central place (components.xml) and not there were they are actually used...
Or am I wrong?
-
3. Re: Which component for a sortable list?
brachie Mar 12, 2008 12:22 PM (in response to wachtda.scsi.gmx.ch)What if I want to display associated objects in a sortable datatable like:
<tr:table value="#{person.tasks}> ...
In this case Hibernate returns a collection of tasks for the person. Should I create an EntityQuery fetching all tasks for the person in my backing bean and use this with the table?
I ask, because in our application we use this type of tables very often. It would be a pain to write an EntityQuery for each associated object collection. Are there other possibilities with less overhead?
Regards,
Alexander
-
4. Re: Which component for a sortable list?
brachie Mar 12, 2008 12:29 PM (in response to wachtda.scsi.gmx.ch)
Daniel Wachter wrote on Mar 12, 2008 08:05 AM:
...
- If I have a list (via Datamodel) the list will be loaded on each access, this happens until I use the trinidad components.
...Hi,
I also realized that behavoir with my trinidad table. Each time I click the header to sort it or page through the results, the lists I also use on that page (e.g. in a h:selectManyList) will be reloaded (at least the getter is called). This leads to a noticeable performance loss when having several entries in the selectManyList. When I use tr:selectManyList instead (the trinidad component) the getter is not called...
Is there anyone who could tell me the reason for that?
Regards,
Alexander
-
5. Re: Which component for a sortable list?
pmuir Mar 12, 2008 1:27 PM (in response to wachtda.scsi.gmx.ch)You can create them in a /com/acme/components.xml or you can use extension as well.
-
6. Re: Which component for a sortable list?
pmuir Mar 12, 2008 1:32 PM (in response to wachtda.scsi.gmx.ch)
Alexander Seitz wrote on Mar 12, 2008 12:22 PM:
I ask, because in our application we use this type of tables very often. It would be a pain to write an EntityQuery for each associated object collection. Are there other possibilities with less overhead?The minimum is 1 line of xml needed per entity query - you want less than that?
-
7. Re: Which component for a sortable list?
pmuir Mar 12, 2008 1:34 PM (in response to wachtda.scsi.gmx.ch)
Alexander Seitz wrote on Mar 12, 2008 12:29 PM:
I also realized that behavoir with my trinidad table. Each time I click the header to sort it or page through the results, the lists I also use on that page (e.g. in a h:selectManyList) will be reloaded (at least the getter is called). This leads to a noticeable performance loss when having several entries in the selectManyList. When I use tr:selectManyList instead (the trinidad component) the getter is not called...
Is there anyone who could tell me the reason for that?Look at putting the query into a longer scope - but then you will need to manually refresh the data.
-
8. Re: Which component for a sortable list?
mars1412 Mar 12, 2008 4:52 PM (in response to wachtda.scsi.gmx.ch)I'm not sure, if I got your right pete.
so you suggest to have onen parent table iterating over some PersonEnityQuery and for each Person you would call the PersonTaskEntityQuery, like that?
<h:dataTable id="personList" var="person" value="#{personEntityQuery.resultList}"> <h:column>#display some person data: #{person.Name}<h:column> <h:column> <h:dataTable id="personTaskList" var="task" value="#{taskEntityQuery.resultList(person.id)}"> #{task.Name} </h:dataTable> </h:column> </h:dataTable>
but that would mean to have 1+n selects on the page (where n is the number of persons)
if we could load the persons (with the task list already initalized - maybe using a fetch join), wouldn't that have a better performance and be more elegant?
<h:dataTable id="personList" var="person" value="#{personEntityQuery.resultList}"> <h:column>#display some person data: #{person.Name}<h:column> <h:column> <h:dataTable id="personTaskList" var="task" value="#{person.tasks)}"> #{task.Name} </h:dataTable> </h:column> </h:dataTable>
does anyone know an example for such a situation?
-
9. Re: Which component for a sortable list?
mpopetz Mar 12, 2008 8:36 PM (in response to wachtda.scsi.gmx.ch) -
10. Re: Which component for a sortable list?
brachie Mar 12, 2008 11:13 PM (in response to wachtda.scsi.gmx.ch)
Marcus Popetz wrote on Mar 12, 2008 08:36 PM:
RichFaces has one too:
Link to Demo
-mpHi,
to be honest, in my opinion the Richfaces scrollable datatable is unuseable in production. It has many bugs like disappearing headers after ajax rerendering, or when you try to sort a date column with null dates you get an exception. Besides there is bunch of javascript to load for this component which increases page size.
In our project we are mainly using Trinidad's datatable, which has sorting and paging (ajax based) out of the box. In addition Pete implemented this sorting and paging database backed for entityQueries with Trinidad's datatable (seamdiscs example).
Alexander
-
11. Re: Which component for a sortable list?
brachie Mar 12, 2008 11:21 PM (in response to wachtda.scsi.gmx.ch)
Pete Muir wrote on Mar 12, 2008 01:32 PM:
Alexander Seitz wrote on Mar 12, 2008 12:22 PM:
I ask, because in our application we use this type of tables very often. It would be a pain to write an EntityQuery for each associated object collection. Are there other possibilities with less overhead?
The minimum is 1 line of xml needed per entity query - you want less than that?Hi,
ok, if you define the entityQueries in the components.xml the overhead is less than e.g. defining factory methods.
In general I would like to use the benefit of Hibernate to access the collection using the object path like person.tasks.
Unfortunately the view does not know how this collection was created, so database backing for sorting or paging is not possible without defining the entityQueries... :(Alexander
-
12. Re: Which component for a sortable list?
pmuir Mar 13, 2008 8:07 PM (in response to wachtda.scsi.gmx.ch)
Martin Trummer wrote on Mar 12, 2008 04:52 PM:
so you suggest to have onen parent table iterating over some PersonEnityQuery and for each Person you would call the PersonTaskEntityQuery, like that?No. In this situation I would prepare the data in the backing bean before outputing to the page. This, IMO, correctly separates the concerns of the presentation layer from accessing data.
-
13. Re: Which component for a sortable list?
sandman202 Mar 13, 2008 9:31 PM (in response to wachtda.scsi.gmx.ch)I tried using ICEFaces and had a few problems. Their datatable is sortable and has a paginator. The problem lies when you have 2 screens with a datatable. When there are links on the first datable to show the second screen, the page crashes due to the paginator. It was one of several reasons I switched to Richfaces.
Alexander, are you using Richfaces with Trinidad or just Trinidad?
Scott
-
14. Re: Which component for a sortable list?
nickarls Mar 13, 2008 9:42 PM (in response to wachtda.scsi.gmx.ch)You don't happen to remember what the exception with the ICEFaces paginator was? I've seen stuff with duplicate ID:s for one of the facets in the paginator.