rowEdit event notworking with hibernate kindly help me :(

UI Components for JSF
Post Reply
mirzabilal186
Posts: 5
Joined: 09 Apr 2013, 16:22

09 Apr 2013, 16:27

Code: Select all

<h:form id="form">
            <p:growl id="messages" showDetail="true"/> 
 
            <p:dataTable  var="hospital" value="#{edithospital.hospitalList}" id="testDT" editable="true" >
 
                <p:ajax event="rowEdit" update="@this" listener="#{edithospital.onEdit}"  />
               <p:ajax event="rowEditCancel" listener="#{tableBean.onCancel}" update=":form:messages" />

                <p:column  headerText="id" >  
                    <p:cellEditor>  
                        <f:facet name="output">
                            <h:outputText value="#{hospital.id}" />  
                        </f:facet>  
                        <f:facet name="input">  
                            <p:inputText value="#{hospital.id}" />  
                        </f:facet>  
                    </p:cellEditor>  
                </p:column>
                
                <p:column  headerText="fname" >  
                    <p:cellEditor>  
                        <f:facet name="output">
                            <h:outputText value="#{hospital.fname}" />  
                        </f:facet>  
                        <f:facet name="input">  
                            <p:inputText value="#{hospital.fname}" />  
                        </f:facet>  
                    </p:cellEditor>  
                </p:column> 

                <p:column headerText="lname" style="width:20%">  
                    <p:cellEditor>  
                        <f:facet name="output">
                            <h:outputText value="#{hospital.lname}" />
                        </f:facet>  
                        <f:facet name="input">  
                            <p:inputText value="#{hospital.lname}" style="width:100%"/>  
                        </f:facet>  
                    </p:cellEditor>  
                </p:column>

                <p:column headerText="Actions" style="width:6%">  
                    <p:rowEditor />
                </p:column> 
            </p:dataTable>  
        </h:form>

 public void onEdit(RowEditEvent event) {

        Transaction transaction = null;
        Session session = null;
      try {
            session = HibernateUtil.getSessionFactory().openSession();
            transaction = session.beginTransaction();
       
            System.out.println("Edit:" + ( (Data) event.getObject()).getFname());
        
     
        transaction.commit();
    
        } catch (HibernateException e) {
            System.out.println(e.getMessage());
        }

    }  
Last edited by mirzabilal186 on 10 Apr 2013, 11:37, edited 1 time in total.

mirzabilal186
Posts: 5
Joined: 09 Apr 2013, 16:22

09 Apr 2013, 16:31

I can not get the updated values using event.getObject())
it returns the old value rather the value which I have updated :(

User avatar
toJuanito
Posts: 11
Joined: 13 Mar 2013, 19:15

09 Apr 2013, 17:37

¿Are you using PF 3.5?

The only solution that i can give you is to switch primefaces version to an older one.
Apache 6.0, Primefaces 3.3.1, JSF 2.1, Hibernate.

/**
* Sorry about my english.
*/

mirzabilal186
Posts: 5
Joined: 09 Apr 2013, 16:22

09 Apr 2013, 18:32

yes we are using primefaces 3.5 any other suggestion so is this the bug in prime faces 3.5

kukeltje
Expert Member
Posts: 9605
Joined: 17 Jun 2010, 13:34
Location: Netherlands

09 Apr 2013, 23:21

Where is the onEdit called? I don't see that anywhere... Maybe I miss something, but please e more descriptive then...

mirzabilal186
Posts: 5
Joined: 09 Apr 2013, 16:22

10 Apr 2013, 11:39

kukeltje wrote:Where is the onEdit called? I don't see that anywhere... Maybe I miss something, but please e more descriptive then...
Now check I have missed the line it was copying mistake
Now check the code plz can you help me ???

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: Google [Bot] and 64 guests