i have a problem using primefaces datatable with multiple selection ( checkbox ) with composite primary key below is my xhtml
<p:dataTable id="cars" var="car" value="#{setujutolakanpencairan.listmktksppencairan0}"
rowKey="#{car.mktksppencairan0PK}"
selection="#{setujutolakanpencairan.mktksppencairan0s}" >
<p:ajax event="rowSelectCheckbox" process="@this"/>
<p:column selectionMode="multiple" style="width:2%" />
<f:facet name="header">
Click "View" button after selecting multiple to see details
</f:facet>
<p:column headerText="Color">
#{car.vcKeterangan}
</p:column>
<f:facet name="footer">
<p:commandButton value="View" icon="ui-icon-search"
update=":form:display" oncomplete="carDialog.show()" actionListener="#{setujutolakanpencairan.outprint()}"/>
</f:facet>
</p:dataTable>
Below is my back bean
private List<Mktksppencairan0> listmktksppencairan0;
private Mktksppencairan0[] mktksppencairan0s;
below is my getter setter
public Mktksppencairan0[] getMktksppencairan0s() {
if (mktksppencairan0s != null) {
for (Object asdf : mktksppencairan0s) {
System.out.println("mktksppencairan0s mktksppencairan0s mktksppencairan0smktksppencairan0s =====" + asdf);
}
}
return mktksppencairan0s;
}
public void setMktksppencairan0s(Mktksppencairan0[] mktksppencairan0s) {
this.mktksppencairan0s = mktksppencairan0s;
}
below is list that display data
public List<Mktksppencairan0> getListmktksppencairan0() {
TypedQuery<Mktksppencairan0> query = em.createNamedQuery("Mktksppencairan0.findBybulantahun", Mktksppencairan0.class);
query.setParameter(
"iTahun", mktkontrol.getTahun());
query.setParameter(
"iBulan", mktkontrol.getBulan());
List<Mktksppencairan0> results = query.getResultList();
return results;
}
public void setListmktksppencairan0(List<Mktksppencairan0> listmktksppencairan0) {
this.listmktksppencairan0 = listmktksppencairan0;
}
here is my action that i used to debug the value
public void outprint() {
System.out.println("asdfasdf ===" + mktksppencairan0s.toString().length());
System.out.println("asdfasdf ===" + mktksppencairan0s.toString());
System.out.println("asdfasdf ===" + mktksppencairan0s);
for (Mktksppencairan0 asdf : mktksppencairan0s) {
System.out.println("mktksppencairan0s mktksppencairan0s mktksppencairan0smktksppencairan0s =====" + asdf.toString().length());
}
}
when i debug using netbeans debugger it is result [] or 0 when i System.out it result
INFO: asdfasdf ===[Lcom.infion.web.biaya_marketing.entity.Mktksppencairan0;@a20a9b
INFO: asdfasdf ===64
INFO: asdfasdf ===[Lcom.infion.web.biaya_marketing.entity.Mktksppencairan0;@1f5db6
INFO: asdfasdf ===[Lcom.infion.web.biaya_marketing.entity.Mktksppencairan0;@1f5db6
FYI im using netbeans 7.3, glassfish 3.1.2 , primefaces 3.5 * the entity i used is generate by netbean so there is have two class of entity Mktksppencairan0PK and Mktksppencairan0 , where Mktksppencairan0 is have embbedded Mktksppencairan0PK thanks for helping me
NB : i have try with non composite primary key ( single primary key ) and its works, but when i try with another composite primary key it doesn't work