-
1. Re: rich:datatable java.util.Set interface support
sergeysmirnov Aug 6, 2007 12:24 PM (in response to tkalactomo)does the standard h:dataTable support Set ?
-
2. Re: rich:datatable java.util.Set interface support
ishabalov Aug 6, 2007 2:09 PM (in response to tkalactomo)No it does not. The reason is that DataTable need ordered list, it require access by index. Set is unordered connection of unique elements, access my index is impossible.
At tye same time somethig as simple as
public List getPersonsList() {
Lis ret = new ArrayList();
ret.addAll(getPersons())
return ret;
}
Can serve the purpose. -
3. Re: rich:datatable java.util.Set interface support
tkalactomo Aug 7, 2007 2:21 AM (in response to tkalactomo)One year ago, we work with tomahawk and they didn't support set interface so we "decanting" from set to list. Utterly stupid and unnecessarily job (my opinion). Then Tomahawk start to support set interface and all our job mean nothing and of course nobody bothered with old code. The reason why to use set is interaction with hibernate.
When you work with hibernate and list its require another index column in table (by my opinion, unnecessarily). Simple way is to use LinkedHashSet because it's leave same order as it gets from database and that order could be set by mapping.
example
@OneToMany(mappedBy = "nadGrana", fetch = FetchType.LAZY)
@OrderBy("id")
public Set getPodGrane() {
return podGrane;
}
Now is critical moment to choose tomahawk datatable or rich datatable.
Now, I wonder how did team at tomahawk implemented set interface, hope they didn't "decanting" from set to list.. -
4. Re: rich:datatable java.util.Set interface support
tkalactomo Aug 7, 2007 2:51 AM (in response to tkalactomo)After consulting with my team member who work with model, we try to simple use List interface to get data from database and IT'S WORK :), so that mean's EJB 3 does this internaly and it's no longer problem.
In hibernate there was need to have index field in database when using List, but now in EJB 3 its no longer necessary, now we know that :)
Before, in hibernate we must use something like this (hbm)
<set name="stavke" cascade="delete-orphan" lazy="false"
order-by= "sifra asc">
<one-to-many class="orka.mkor.mapping.dokumenti.robni.InventuraStavka"/>
Now, analogue, we tried this, and it's conflict with rich:datatable
private Set podredeni = new LinkedHashSet();
@OneToMany(mappedBy = "nadredeni", targetEntity = SimpleSifarnik.class)
@Filter(name="time", condition="datumKreiranja <= :time")
@OrderBy("id")
public Set getPodredeni() {
return podredeni;
}
public void setPodredeni(Set podredeni) {
this.podredeni = podredeni;
}
Now, after just use List everiting work just fine
private List podredeni = new Vector();
@OneToMany(mappedBy = "nadredeni", targetEntity = SimpleSifarnik.class)
@Filter(name="time", condition="datumKreiranja <= :time")
@OrderBy("id")
public List getPodredeni() {
return podredeni;
}
public void setPodredeni(List podredeni) {
this.podredeni = podredeni;
} -
5. Re: rich:datatable java.util.Set interface support
ishabalov Aug 7, 2007 8:51 PM (in response to tkalactomo)I guess we still have open question to support Set in Data Table
-
6. Re: rich:datatable java.util.Set interface support
tkalactomo Aug 8, 2007 5:47 AM (in response to tkalactomo)I think you should support Set!
-
7. Re: rich:datatable java.util.Set interface support
budoray Aug 17, 2007 7:40 PM (in response to tkalactomo)Supporting Set would allow us make use of the java.util.concurrent package.
-
8. Re: rich:datatable java.util.Set interface support
pmuir Aug 19, 2007 5:57 PM (in response to tkalactomo)+1
Is there a JIRA issue for this
(n.b. Seam has a SetDataModel which could be used).