• Post Reply Bookmark Topic Watch Topic
  • New Topic

When does <h:datatable> support sets?

 
Remko Strating
Ranch Hand
Posts: 893
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I started to use JPA and this works fine

The relationships between entities are mostly defined as sets when I want to make sure that there are no duplicates. Now I understand by trying that h:datatable doesn't support sets. In my backing bean I have now to convert the set to a list and then it shows. I don't like this code and have also to check for null-references.

The Tomahawk datatable does support sets? I've read, but I try to keep to use the h:datatable.

I use the JSF1.1 implementation and I'm planning to upgrade to JSF1.2. Does the h:datatable support sets in JSF1.2?
Will this support included with the JSF2.0 in the future?

Thanks for your reaction,

 
Bauke Scholtz
Ranch Hand
Posts: 2458
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Once sets supports obtaining objects by index.

With other words: never

Convert it to List or DataModel.
 
Remko Strating
Ranch Hand
Posts: 893
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
They could alleviate this requirement or making a dummy index or not using an index at all.

A Set is just a basic collection in Java so they would support this, but that's an another discussion.

I will make a helper class which will transform the Set in a List. This is better and less error prone then writing this over and over again in your backing beans.

Only I just hoped this wasn't needed, because it gives me the feeling that I develop my own framework.

 
Bauke Scholtz
Ranch Hand
Posts: 2458
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Converting Set to List isn't that hard. The ArrayList constructor can take a Set (and vice versa).
 
Remko Strating
Ranch Hand
Posts: 893
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Bauke,

Thanks for your tip.

I already did this, but it felt to me like a kind off heck.

Before starting to use JPA I never used sets within a <h:datatable> and I hoped this wasn't needed.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!