3 Replies Latest reply on Aug 29, 2007 1:00 PM by Dustin Norlander

    Hibernate : insertion in DataBase with java code.

    Aymen Newbie

      Hi,
      I'm using Jboss Seam 1.2.1.GA + Jboss Server 4.0.5.GA. I'm trying to add rows in the DataBase, using hibernate, with the code. I tryed this :

      ChargeCollaborateuraffecteHome chargeCollaborateuraffecteHome = new ChargeCollaborateuraffecteHome();
      ChargeCollaborateurAffecte chargeCollaborateurAffecte = chargeCollaborateuraffecteHome.createInstance();
      
      chargeCollaborateurAffecte.setChargeEffective(charge);
      chargeCollaborateurAffecte.setChargePrevisionnelle(0);
      chargeCollaborateurAffecte.setCollaborateurAffecte(this);
      chargeCollaborateurAffecte.setDate(dateCharge);
       chargeCollaborateuraffecteHome.setInstance(chargeCollaborateurAffecte);
      
      chargeCollaborateuraffecteHome.persist();


      But I have an exception caused by the persist() (line 208):
      Caused by: java.lang.NullPointerException
       at org.jboss.seam.framework.Home.updatedMessage(Home.java:40)
       at org.jboss.seam.framework.EntityHome.update(EntityHome.java:40)
       at com.fitnetapplication.resources.model.CollaborateurAffecte.setChargeEffective(CollaborateurAffecte.java:208)
       at crossTable.action.activitesByCollaborateurCrossDataBean.sauvgarderCrossDataTable(activitesByCollaborateurCrossDataBean.java:150)
       at crossTable.action.activitesByCollaborateurCrossDataBean.chercherActivites(activitesByCollaborateurCrossDataBean.java:125)
      


      Please help a Newbie!