0 Replies Latest reply on Jan 24, 2007 9:43 AM by Thomas Kratz

    SeamTest Entity Life Cycle

    Thomas Kratz Newbie

      We have a Stateful Bean that loads our currentUser object (An @Entity) and outjects it. It is the injected to an stateless action bean that edits the password of the userObject. When I run this in JBoss environment the Entity seems to get detached from the hibernate session Context as I can alter the passwort, reload the Entity from the DB and no update is issued.

      ( need to do this because I want to compare old and new password)

      Now I wrote a SeamTest to test the Action class. When I run the same code in the embedded Container, the Entity somehow seems to be attached to the Hibernate Session, as hibernate executes an update on my changed passwort before it reloads the Entity from the database. I hoped to have the same behaviour in both environments.

      Has anyone made similar experiences ? any help is appreciated as we surely want to Test out action classes.

      Thx Thomas

      // passwort is changed on selectedBenutzer
      // in Jboss the old entity is reloaded from the db
      // in SeamTest hibernate executes an update before it does the select
      Benutzer oldbenutzer = benutzerDAO.findByPrimaryKey(selectedBenutzer.getId());
      String oldpasswort = alterbenutzer.getPasswort();