2 Replies Latest reply on May 27, 2009 8:14 AM by Diego Palumbo

    Rows in rich:dataTable do not fire any action

    Diego Palumbo Newbie

      Hi everybody!
      I have an unusual behavior with rich:dataTable component.
      I tried to modify a page with standard h:datatable component to rich:dataTable with datascroller.

      The problem is that now the associated row action method is not called.


      I modified a lot of other pages (all the pages are similar because automatically generated) in order to replace h:datatable with rich:datatable and I had no problem.
      The only difference in this page is that the associated entity class has composite primary key. (but I can't think to any connection with this behavior)

      Any suggestion? Has someone found the same problem?

      The dataTable Page is the Follow.
      Red code should have to fire the action listDetailSetup. When I click on the h:commandlink i see that a request is fired but the listDetailSetup method is not called (in debug mode).

      
      <%@page contentType="text/html"%>
      <%@page pageEncoding="UTF-8"%>
      <%@taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
      <%@taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
      <%@taglib uri="http://richfaces.org/a4j" prefix="a4j" %>
      <%@taglib uri="http://richfaces.org/rich" prefix="rich" %>
      <%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
      
      <h:panelGroup id="messagePanel" layout="block">
       <h:messages errorStyle="color: red" infoStyle="color: green" layout="table"/>
      </h:panelGroup>
      
      <h2> <h:outputText value="#{label.Workflow} #{label.titolo}"/> </h2>
      <br/>
      <h:form styleClass="jsfcrud_list_form">
      
       <h:panelGrid columns="2">
       <h:outputText escape="false" value="#{label.filtro} #{label.avan} #{label.operazioni} "/>
       <h:selectOneMenu id="filtrostato"
       value="#{wkfopert.tabstaoper}"
       valueChangeListener="#{wkfopert.filtrostatoListener}"
       onchange="this.form.submit()" immediate="true">
       <f:selectItems value="#{tabstaoper.tabstaoperItemsAvailableSelectOne}"/>
       </h:selectOneMenu>
       </h:panelGrid> <br />
       <h:panelGroup rendered="#{wkfopert.objectCount > 0}">
       <rich:datascroller align="left" id="sc2" for="list" maxPages="10" fastStep="2" ajaxSingle="false">
       <f:facet name="first">
       <h:graphicImage url="/resources/css/images/22-backlist.png" title="#{label.paginaInizio}"/>
       </f:facet>
       <f:facet name="fastrewind">
       <h:graphicImage url="/resources/css/images/22-back.png" title="#{label.pagina2Prec}"/>
       </f:facet>
       <f:facet name="previous">
       <h:graphicImage url="/resources/css/images/22-singleBack.png" title="#{label.paginaPrec}"/>
       </f:facet>
       <f:facet name="next">
       <h:graphicImage url="/resources/css/images/22-singleNext.png" title="#{label.paginaSucc}"/>
       </f:facet>
       <f:facet name="fastforward">
       <h:graphicImage url="/resources/css/images/22-next.png" title="#{label.pagina2Succ}"/>
       </f:facet>
       <f:facet name="last">
       <h:graphicImage url="/resources/css/images/22-forwardlist.png" title="#{label.paginaFine}"/>
       </f:facet>
       </rich:datascroller>
       <h:outputText escape="false" value="#{label.nooper}<br />" rendered="#{wkfopert.objectCount == 0}" />
       <rich:dataTable value="#{wkfopert}"
       var="item"
       id="list"
       rowClasses="jsfcrud_odd_row,jsfcrud_even_row"
       headerClass="richTableHeader"
       rows="5">
       <h:column>
       <f:facet name="header">
       <h:outputText value="#{label.avan}"/>
       </f:facet>
       <h:outputText value=" #{item.statoavan.descshort}"/>
       </h:column>
       <h:column>
       <f:facet name="header">
       <h:outputText value="#{label.id}"/>
       </f:facet>
       <h:outputText value=" #{item.wkfopertPK.id}"/>
       </h:column>
       <h:column>
       <f:facet name="header">
       <h:outputText value="#{label.anno}"/>
       </f:facet>
       <h:outputText value=" #{item.wkfopertPK.anno}"/>
       </h:column>
       <h:column>
       <f:facet name="header">
       <h:outputText value="#{label.dataesec}"/>
       </f:facet>
       <h:outputText value=" #{item.dataesecFormatted}"/>
       </h:column>
       <h:column>
       <f:facet name="header">
       <h:outputText value="#{label.oraesec}"/>
       </f:facet>
       <h:outputText value=" #{item.oraesecFormatted}"/>
       </h:column>
       <h:column>
       <f:facet name="header">
       <h:outputText value="#{label.idAlert}"/>
       </f:facet>
       <h:outputText value=" #{item.idalert.id}"/>
       </h:column>
       <h:column>
       <f:facet name="header">
       <h:outputText value="#{label.livello}"/>
       </f:facet>
       <h:outputText value=" #{item.livalert}"/>
       </h:column>
       <h:column>
       <f:facet name="header">
       <h:outputText value="#{label.msgAlert}"/>
       </f:facet>
       <h:outputText value=" #{item.msgalert}"/>
       </h:column>
       <h:column>
       <f:facet name="header">
       <h:outputText value="#{label.open}"/>
       </f:facet>
       <h:outputText value=" #{item.numopen}"/>
       </h:column>
       <h:column>
       <f:facet name="header">
       <h:outputText value="#{label.close}"/>
       </f:facet>
       <h:outputText value=" #{item.numclose}"/>
       </h:column>
       <h:column>
       <f:facet name="header">
       <h:outputText value="Query"/>
       </f:facet>
       <h:outputText value=" #{item.queryDesc}"/>
       </h:column>
       <h:column>
       <f:facet name="header">
       <h:outputText value="#{label.caus}"/>
       </f:facet>
       <h:outputText value=" #{item.causale}"/>
       </h:column>
       <h:column>
       <f:facet name="header">
       <h:outputText value="#{label.utente}"/>
       </f:facet>
       <h:outputText value=" #{item.user}"/>
       </h:column>
       <h:column>
       <f:facet name="header">
       <h:outputText escape="false" value=" "/>
       </f:facet>
      
      
       <h:commandLink action="#{wkfopert.listDetailSetup}">
       <h:graphicImage height="16px" url="/resources/css/images/16-list.png" title="#{label.visualizza} #{label.listDetail}"/>
       <f:param name="jsfcrud.currentWkfopert" value="#{jsfcrud_class['operazioniSospette.jsf.util.JsfUtil'].jsfcrud_method['getAsConvertedString'][item][wkfopert.converter].jsfcrud_invoke}"/>
       </h:commandLink>
      
       </h:column>
       </rich:dataTable>
       </h:panelGroup>
      </h:form>
      



      the follow is the page controller bean:

      
      package operazioniSospette.jsf;
      
      import entities.Tabstaoper;
      import entities.Utenti;
      import entities.Wkfopert;
      import java.awt.event.ActionEvent;
      import java.lang.reflect.InvocationTargetException;
      import java.lang.reflect.Method;
      import java.util.List;
      import javax.faces.FacesException;
      import javax.faces.component.*;
      import javax.faces.context.FacesContext;
      import javax.faces.convert.Converter;
      import javax.faces.model.SelectItem;
      import operazioniSospette.db.WkfopertJpaController;
      import operazioniSospette.jsf.util.JsfUtil;
      import operazioniSospette.db.exceptions.NonexistentEntityException;
      import entities.WkfopertPK;
      import javax.faces.component.html.HtmlSelectOneMenu;
      import javax.faces.event.ValueChangeEvent;
      //import operazioniSospette.jsf.util.PagingInfo;
      import util.JSFUtil;
      
      /**
       *
       * @author d.palumbo
       */
      public class WkfopertController extends GenericController {
      
       private Wkfopert wkfopert = null;
      // private List<Wkfopert> wkfopertItems = null;
       private WkfopertJpaController jpaController = null;
       private WkfopertConverter converter = null;
      // private PagingInfo pagingInfo = null;
       private Tabstaoper tabstaoper = null;
       private Tabstaoper filtrostato = null;
       private TabstaoperConverter tabstaoperConverter = null;
       private SelectItem item = null;
      
       public WkfopertController() {
       FacesContext facesContext = FacesContext.getCurrentInstance();
       jpaController = (WkfopertJpaController) facesContext.getApplication().getELResolver().getValue(facesContext.getELContext(), null, "wkfopertJpa");
       // pagingInfo = new PagingInfo();
       converter = new WkfopertConverter();
       tabstaoperConverter = new TabstaoperConverter();
       }
      
       /* public PagingInfo getPagingInfo() {
       if (pagingInfo.getItemCount() == -1) {
       pagingInfo.setItemCount(jpaController.getWkfopertCount((Utenti) JSFUtil.getSessionUser(), getTabstaoper()));
       }
       return pagingInfo;
       } */
       public SelectItem[] getWkfopertItemsAvailableSelectMany() {
       return JsfUtil.getSelectItems(jpaController.findWkfopertEntities(), false);
       }
      
       public SelectItem[] getWkfopertItemsAvailableSelectOne() {
       return JsfUtil.getSelectItems(jpaController.findWkfopertEntities(), true);
       }
      
       public Wkfopert getWkfopert() {
       if (wkfopert == null) {
       wkfopert = (Wkfopert) JsfUtil.getObjectFromRequestParameter("jsfcrud.currentWkfopert", converter, null);
       }
       if (wkfopert == null) {
       wkfopert = new Wkfopert();
       }
       return wkfopert;
       }
      
       public String listSetup() {
       reset(true);
       return "wkfopert_list";
       }
      
       public String listDetailSetup() {
       FacesContext ctx = FacesContext.getCurrentInstance();
       Wkfopert opert = (Wkfopert) JsfUtil.getObjectFromRequestParameter("jsfcrud.currentWkfopert", converter, null);
       util.JSFUtil.storeOnSession(ctx, "jsfcrud.currentWkfopert", opert);
       reset(true);
       return "wkfoperd_list";
       }
      
       public String createSetup() {
       reset(false);
       wkfopert = new Wkfopert();
       wkfopert.setWkfopertPK(new WkfopertPK());
       return "wkfopert_create";
       }
      
       public String create() {
       try {
       jpaController.create(wkfopert);
       JsfUtil.addSuccessMessage("Wkfopert was successfully created.");
       } catch (Exception e) {
       JsfUtil.ensureAddErrorMessage(e, "A persistence error occurred.");
       return null;
       }
       return listSetup();
       }
      
       public String detailSetup() {
       return scalarSetup("wkfopert_detail");
       }
      
       public String editSetup() {
       return scalarSetup("wkfopert_edit");
       }
      
       private String scalarSetup(String destination) {
       reset(false);
       wkfopert = (Wkfopert) JsfUtil.getObjectFromRequestParameter("jsfcrud.currentWkfopert", converter, null);
       if (wkfopert == null) {
       String requestWkfopertString = JsfUtil.getRequestParameter("jsfcrud.currentWkfopert");
       JsfUtil.addErrorMessage("The wkfopert with id " + requestWkfopertString + " no longer exists.");
       return relatedOrListOutcome();
       }
       return destination;
       }
      
       public String edit() {
       String wkfopertString = converter.getAsString(FacesContext.getCurrentInstance(), null, wkfopert);
       String currentWkfopertString = JsfUtil.getRequestParameter("jsfcrud.currentWkfopert");
       if (wkfopertString == null || wkfopertString.length() == 0 || !wkfopertString.equals(currentWkfopertString)) {
       String outcome = editSetup();
       if ("wkfopert_edit".equals(outcome)) {
       JsfUtil.addErrorMessage("Could not edit wkfopert. Try again.");
       }
       return outcome;
       }
       try {
       jpaController.edit(wkfopert);
       JsfUtil.addSuccessMessage("Wkfopert was successfully updated.");
       } catch (NonexistentEntityException ne) {
       JsfUtil.addErrorMessage(ne.getLocalizedMessage());
       return listSetup();
       } catch (Exception e) {
       JsfUtil.ensureAddErrorMessage(e, "A persistence error occurred.");
       return null;
       }
       return detailSetup();
       }
      
       public String destroy() {
       String idAsString = JsfUtil.getRequestParameter("jsfcrud.currentWkfopert");
       WkfopertPK id = converter.getId(idAsString);
       try {
       jpaController.destroy(id);
       JsfUtil.addSuccessMessage("Wkfopert was successfully deleted.");
       } catch (NonexistentEntityException ne) {
       JsfUtil.addErrorMessage(ne.getLocalizedMessage());
       return relatedOrListOutcome();
       } catch (Exception e) {
       JsfUtil.ensureAddErrorMessage(e, "A persistence error occurred.");
       return null;
       }
       return relatedOrListOutcome();
       }
      
       private String relatedOrListOutcome() {
       String relatedControllerOutcome = relatedControllerOutcome();
       if (relatedControllerOutcome != null) {
       return relatedControllerOutcome;
       }
       return listSetup();
       }
      
       //Recupera i dati in base a filtri specificati e accesso utente
      /* public List<Wkfopert> getWkfopertItems() {
       if (wkfopertItems == null) {
       getPagingInfo();
       wkfopertItems = jpaController.findWkfopertEntities(false, pagingInfo.getBatchSize(), pagingInfo.getFirstItem(), (Utenti) JSFUtil.getSessionUser(), getTabstaoper());
       }
       return wkfopertItems;
       } */
       public String next() {
       reset(false);
      // getPagingInfo().nextPage();
       return "wkfopert_list";
       }
      
       public String prev() {
       reset(false);
      // getPagingInfo().previousPage();
       return "wkfopert_list";
       }
      
       private String relatedControllerOutcome() {
       String relatedControllerString = JsfUtil.getRequestParameter("jsfcrud.relatedController");
       String relatedControllerTypeString = JsfUtil.getRequestParameter("jsfcrud.relatedControllerType");
       if (relatedControllerString != null && relatedControllerTypeString != null) {
       FacesContext context = FacesContext.getCurrentInstance();
       Object relatedController = context.getApplication().getELResolver().getValue(context.getELContext(), null, relatedControllerString);
       try {
       Class<?> relatedControllerType = Class.forName(relatedControllerTypeString);
       Method detailSetupMethod = relatedControllerType.getMethod("detailSetup");
       return (String) detailSetupMethod.invoke(relatedController);
       } catch (ClassNotFoundException e) {
       throw new FacesException(e);
       } catch (NoSuchMethodException e) {
       throw new FacesException(e);
       } catch (IllegalAccessException e) {
       throw new FacesException(e);
       } catch (InvocationTargetException e) {
       throw new FacesException(e);
       }
       }
       return null;
       }
      
       private void reset(boolean resetFirstItem) {
       wkfopert = null;
       resetSavedRow();
      /* wkfopertItems = null;
       pagingInfo.setItemCount(-1);
       if (resetFirstItem) {
       pagingInfo.setFirstItem(0);
       } */
       }
      
       public void validateCreate(FacesContext facesContext, UIComponent component, Object value) {
       Wkfopert newWkfopert = new Wkfopert();
       newWkfopert.setWkfopertPK(new WkfopertPK());
       String newWkfopertString = converter.getAsString(FacesContext.getCurrentInstance(), null, newWkfopert);
       String wkfopertString = converter.getAsString(FacesContext.getCurrentInstance(), null, wkfopert);
       if (!newWkfopertString.equals(wkfopertString)) {
       createSetup();
       }
       }
      
       public Converter getConverter() {
       return converter;
       }
      
       public void filtrostatoListener(ValueChangeEvent event) {
       reset(false);
       setTabstaoper((Tabstaoper) event.getNewValue());
      // getPagingInfo();
      // getWkfopertItems();
       JSFUtil.storeOnSession(FacesContext.getCurrentInstance(), "jsfcrud.currentFiltro", getTabstaoper());
       //salta direttamente alla fase di Render Response per evitare la convalida
       FacesContext context = FacesContext.getCurrentInstance();
       context.renderResponse();
       }
      
       public Tabstaoper getTabstaoper() {
       /* if (tabstaoper == null) {
       tabstaoper = (Tabstaoper) JsfUtil.getObjectFromRequestParameter("jsfcrud.currentTabstaoper", getTabstaoperConverter(), null);
       }
       if (tabstaoper == null) {
       tabstaoper = new Tabstaoper();
       }
       if (tabstaoper.getIdstato() == null) {
       tabstaoper = (Tabstaoper) JsfUtil.getObjectFromRequestParameter("jsfcrud.currentTabstaoper", getTabstaoperConverter(), null);
       } */
       return tabstaoper;
       }
      
       public void setTabstaoper(Tabstaoper tabstaoper) {
       this.tabstaoper = tabstaoper;
       }
      
       public Tabstaoper getFiltrostato() {
       return filtrostato;
       }
      
       public void setFiltrostato(Tabstaoper filtrostato) {
       this.filtrostato = filtrostato;
       }
      
       public TabstaoperConverter getTabstaoperConverter() {
       return tabstaoperConverter;
       }
      
       public void setTabstaoperConverter(TabstaoperConverter tabstaoperConverter) {
       this.tabstaoperConverter = tabstaoperConverter;
       }
      
       public SelectItem getItem() {
       return item;
       }
      
       public void setItem(SelectItem item) {
       this.item = item;
       }
      
       // per RichFaces -------------------------------------------------------------
       @Override
       public int getObjectCount() {
       return jpaController.getWkfopertCount((Utenti) JSFUtil.getSessionUser(), getTabstaoper());
       }
      
       @Override
       public List getItemList(int numberOfRows, int firstRow) {
       return jpaController.findWkfopertEntities(false, numberOfRows, firstRow, (Utenti) JSFUtil.getSessionUser(), getTabstaoper());
       }
      
       @Override
       public Object getItemPrimaryKey(Object item) {
       return ((Wkfopert) item).getWkfopertPK();
       }
      
       @Override
       public Object getItemByKey(Object currentPk) {
       return jpaController.findWkfopert((WkfopertPK) currentPk);
       }
      }
      
      


      the entity class associated is:


      /*
       * To change this template, choose Tools | Templates
       * and open the template in the editor.
       */
      
      package entities;
      
      import java.io.Serializable;
      import java.util.List;
      import javax.persistence.CascadeType;
      import javax.persistence.Column;
      import javax.persistence.EmbeddedId;
      import javax.persistence.Entity;
      import javax.persistence.FetchType;
      import javax.persistence.JoinColumn;
      import javax.persistence.ManyToOne;
      import javax.persistence.NamedQueries;
      import javax.persistence.NamedQuery;
      import javax.persistence.OneToMany;
      import javax.persistence.Table;
      import util.DateUtil;
      import util.TimeUtil;
      
      /**
       *
       * @author f.palumbo
       */
      @Entity
      @Table(name = "WKFOPERT")
      //@NamedQueries({@NamedQuery(name = "Wkfopert.findAll", query = "SELECT w FROM Wkfopert w"), @NamedQuery(name = "Wkfopert.findByAnno", query = "SELECT w FROM Wkfopert w WHERE w.wkfopertPK.anno = :anno"), @NamedQuery(name = "Wkfopert.findById", query = "SELECT w FROM Wkfopert w WHERE w.wkfopertPK.id = :id"), @NamedQuery(name = "Wkfopert.findByLivalert", query = "SELECT w FROM Wkfopert w WHERE w.livalert = :livalert"), @NamedQuery(name = "Wkfopert.findByMsgalert", query = "SELECT w FROM Wkfopert w WHERE w.msgalert = :msgalert"), @NamedQuery(name = "Wkfopert.findByDataesec", query = "SELECT w FROM Wkfopert w WHERE w.dataesec = :dataesec"), @NamedQuery(name = "Wkfopert.findByOraesec", query = "SELECT w FROM Wkfopert w WHERE w.oraesec = :oraesec"), @NamedQuery(name = "Wkfopert.findByNumopen", query = "SELECT w FROM Wkfopert w WHERE w.numopen = :numopen"), @NamedQuery(name = "Wkfopert.findByNumclose", query = "SELECT w FROM Wkfopert w WHERE w.numclose = :numclose")})
      @NamedQueries({@NamedQuery(name = "Wkfopert.findAll", query = "SELECT w FROM Wkfopert w"), @NamedQuery(name = "Wkfopert.findByAnno", query = "SELECT w FROM Wkfopert w WHERE w.wkfopertPK.anno = :anno"), @NamedQuery(name = "Wkfopert.findById", query = "SELECT w FROM Wkfopert w WHERE w.wkfopertPK.id = :id")})
      public class Wkfopert implements Serializable {
       private static final long serialVersionUID = 1L;
       @EmbeddedId
       protected WkfopertPK wkfopertPK;
       @Column(name = "LIVALERT")
       private Character livalert;
       @Column(name = "MSGALERT")
       private String msgalert;
       @Column(name = "DATAESEC")
       private Integer dataesec;
       @Column(name = "ORAESEC")
       private Integer oraesec;
       @Column(name = "NUMOPEN")
       private Integer numopen;
       @Column(name = "NUMCLOSE")
       private Integer numclose;
       @OneToMany(mappedBy = "wkfopert")
       private List<Wkfoperd> wkfoperdCollection;
       @JoinColumn(name = "IDQUERY", referencedColumnName = "ID")
       @ManyToOne(optional = false, fetch = FetchType.EAGER)
       private Anaquery idquery;
       @JoinColumn(name = "IDALERT", referencedColumnName = "ID")
       @ManyToOne(optional = false, fetch = FetchType.EAGER)
       private Tabalert idalert;
       @JoinColumn(name = "CAUSALEQRY", referencedColumnName = "ID")
       @ManyToOne(fetch = FetchType.EAGER)
       private Tabcausal causaleqry;
       @JoinColumn(name = "STATOAVAN", referencedColumnName = "IDSTATO")
       @ManyToOne(fetch = FetchType.EAGER)
       private Tabstaoper statoavan;
       @JoinColumn(name = "IDUSER", referencedColumnName = "id")
       @ManyToOne(optional = false, fetch = FetchType.EAGER)
       private Utenti iduser;
      
      
      
       public Wkfopert() {
       }
      
       public Wkfopert(WkfopertPK wkfopertPK) {
       this.wkfopertPK = wkfopertPK;
       }
      
       public Wkfopert(short anno, int id) {
       this.wkfopertPK = new WkfopertPK(anno, id);
       }
      
       public WkfopertPK getWkfopertPK() {
       return wkfopertPK;
       }
      
       public void setWkfopertPK(WkfopertPK wkfopertPK) {
       this.wkfopertPK = wkfopertPK;
       }
      
       public Character getLivalert() {
       return livalert;
       }
      
       public void setLivalert(Character livalert) {
       this.livalert = livalert;
       }
      
       public String getMsgalert() {
       return msgalert;
       }
      
       public void setMsgalert(String msgalert) {
       this.msgalert = msgalert;
       }
      
       public Integer getDataesec() {
       return dataesec;
       }
      
       public void setDataesec(Integer dataesec) {
       this.dataesec = dataesec;
       }
      
       public String getDataesecFormatted() {
       return DateUtil.intToString( dataesec );
       }
      
       public Integer getOraesec() {
       return oraesec;
       }
      
       public String getOraesecFormatted() {
       return TimeUtil.intToString( oraesec );
       }
      
       public void setOraesec(Integer oraesec) {
       this.oraesec = oraesec;
       }
      
       public Integer getNumopen() {
       return numopen;
       }
      
       public void setNumopen(Integer numopen) {
       this.numopen = numopen;
       }
      
       public Integer getNumclose() {
       return numclose;
       }
      
       public void setNumclose(Integer numclose) {
       this.numclose = numclose;
       }
      
       public Anaquery getIdquery() {
       return idquery;
       }
      
       public void setIdquery(Anaquery idquery) {
       this.idquery = idquery;
       }
      
       public String getQueryDesc() {
       return idquery.getDescrizione4List();
       }
      
       public Tabalert getIdalert() {
       return idalert;
       }
      
       public void setIdalert(Tabalert idalert) {
       this.idalert = idalert;
       }
      
       public Tabcausal getCausaleqry() {
       return causaleqry;
       }
      
       public String getCausale() {
       return causaleqry.getDescshort();
       }
      
       public void setCausaleqry(Tabcausal causaleqry) {
       this.causaleqry = causaleqry;
       }
      
       public Tabstaoper getStatoavan() {
       return statoavan;
       }
      
       public void setStatoavan(Tabstaoper statoavan) {
       this.statoavan = statoavan;
       }
      
       public Utenti getIduser() {
       return iduser;
       }
      
       public String getUser() {
       return iduser.getUsername();
       }
      
       public void setIduser(Utenti iduser) {
       this.iduser = iduser;
       }
      
       @Override
       public int hashCode() {
       int hash = 0;
       hash += (wkfopertPK != null ? wkfopertPK.hashCode() : 0);
       return hash;
       }
      
       @Override
       public boolean equals(Object object) {
       // TODO: Warning - this method won't work in the case the id fields are not set
       if (!(object instanceof Wkfopert)) {
       return false;
       }
       Wkfopert other = (Wkfopert) object;
       if ((this.wkfopertPK == null && other.wkfopertPK != null) || (this.wkfopertPK != null && !this.wkfopertPK.equals(other.wkfopertPK))) {
       return false;
       }
       return true;
       }
      
       @Override
       public String toString() {
       return "entities.Wkfopert[wkfopertPK=" + wkfopertPK + "]";
       }
      
       public List<Wkfoperd> getWkfoperdCollection() {
       return wkfoperdCollection;
       }
      
       public void setWkfoperdCollection(List<Wkfoperd> wkfoperdCollection) {
       this.wkfoperdCollection = wkfoperdCollection;
       }
      
      }
      
      
      /*
       * To change this template, choose Tools | Templates
       * and open the template in the editor.
       */
      
      package entities;
      
      import java.io.Serializable;
      import javax.persistence.Basic;
      import javax.persistence.Column;
      import javax.persistence.Embeddable;
      
      /**
       *
       * @author f.palumbo
       */
      @Embeddable
      public class WkfopertPK implements Serializable {
       @Basic(optional = false)
       @Column(name = "ANNO")
       private short anno;
       @Basic(optional = false)
       @Column(name = "ID")
       private int id;
      
       public WkfopertPK() {
       }
      
       public WkfopertPK(short anno, int id) {
       this.anno = anno;
       this.id = id;
       }
      
       public short getAnno() {
       return anno;
       }
      
       public void setAnno(short anno) {
       this.anno = anno;
       }
      
       public int getId() {
       return id;
       }
      
       public void setId(int id) {
       this.id = id;
       }
      
       @Override
       public int hashCode() {
       int hash = 0;
       hash += (int) anno;
       hash += (int) id;
       return hash;
       }
      
       @Override
       public boolean equals(Object object) {
       // TODO: Warning - this method won't work in the case the id fields are not set
       if (!(object instanceof WkfopertPK)) {
       return false;
       }
       WkfopertPK other = (WkfopertPK) object;
       if (this.anno != other.anno) {
       return false;
       }
       if (this.id != other.id) {
       return false;
       }
       return true;
       }
      
       @Override
       public String toString() {
       return "entities.WkfopertPK[anno=" + anno + ", id=" + id + "]";
       }
      
      }
      
      


      Thack you