We have a Stateful Bean that loads our currentUser object (An @Entity) and outjects it. It is then 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. In a first request I assure the Stateful Bean is instantiated, in a second request i actually test the action bean. I tried to use two requests but it doesnt help. When I run the 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.
// passwort is changed on currentUser // in Jboss the old entity is reloaded from the db // in SeamTest hibernate executes an update before it does the select Benutzer oldUser = benutzerDAO.findByPrimaryKey(currentUser.getId()); String oldpasswort = oldbenutzer.getPasswort(); benutzerDAO.changeBenutzer(currentBenutzer, newPasswd);
sorry for the double post, the forum got stuck when i did the first post.