Bonjour,
je fait la modification d'un tableau de binding à ma base de données, en utilisant les pojoo hibernate voici le code de ma méthode.
Code :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
 
    public String button1_action() throws RollbackException {
 
            // TODO: Process the action. Return value is a navigation
            // case name where null will return to the same page.
            RowKey rowKey = tableRowGroup1.getRowKey();
            String cod_serv = (String)    serviceDataProvider.getValue("service.Code_serv",rowKey);
            String nom_serv = (String) nom.getValue();
            String lieu_serv = (String) lieu.getValue();
            String fonction_serv = (String) fonction.getValue();
             try {
                serviceDataProvider.removeRow(rowKey);
                serviceDataProvider.commitChanges();
            } catch (Exception e) {
                error("Cannot delete trip with row key " + rowKey + e);
            }
            Session session = HibernateUtil.getSessionFactory().openSession();
            Transaction tx = null;
            session.beginTransaction();
            Service service = new Service();
            service= (Service) session.get(Service.class,cod_serv);
            service.setFonction(fonction_serv);
            service.setLieu(lieu_serv);
            service.setNom(nom_serv);
            session.save(service);
            session.beginTransaction().commit();
            session.clear();
            session.close();
            return null;
 
    }
et voici l'exception qui me génère:
Code :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
 
Description:  An unhandled exception occurred during the execution of the web application. Please review the following stack trace for more information regarding the error.
 
Exception Details: java.lang.IllegalArgumentException
  id to load is required for loading
 
Possible Source of Error:
   Class Name: org.hibernate.event.LoadEvent
   File Name: LoadEvent.java
   Method Name:
   Line Number: 51
 
Source not available. Information regarding the location of the exception can be identified using the exception stack trace below.
 
Stack Trace:
 
org.hibernate.event.LoadEvent.(LoadEvent.java:51)
org.hibernate.event.LoadEvent.(LoadEvent.java:33)
org.hibernate.impl.SessionImpl.get(SessionImpl.java:812)
org.hibernate.impl.SessionImpl.get(SessionImpl.java:808)
prj22.Page1.button1_action(Page1.java:241)
sun.reflect.NativeMethodAccessorImpl.invoke0(NativeMethodAccessorImpl.java:-2)
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
java.lang.reflect.Method.invoke(Method.java:597)
org.apache.el.parser.AstValue.invoke(AstValue.java:172)
org.apache.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:276)
org.apache.jasper.el.JspMethodExpression.invoke(JspMethodExpression.java:68)
javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:77)
com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:91)
com.sun.rave.web.ui.appbase.faces.ActionListenerImpl.processAction(ActionListenerImpl.java:91)
javax.faces.component.UICommand.broadcast(UICommand.java:383)
 
 
javalhoussain est actuellement connecté Signaler un message hors-charte   	Envoyer un message privé Modifier/Supprimer le message