You can find the full source code for this website in the Seam package in the directory /examples/wiki. It is licensed under the LGPL.
| Online: | 27 Members of 4511 |
| Forum: Seam Users |
20. Mar 2008, 17:05 CET | Link |
I currently have a stupid simple problem, I almost don't dare to ask. It is about removing a persisted entity from the DB in a TestNG routine.
The remove-method looks very simple:
public void removeUser(MyUser user) {
log.fatal("removeUser");
em.remove(user);
log.fatal("DONE removeUser");
user=null;
}
During the test I first create the instance in the DB successfully and subsequently remove it again. After this operation I search for the record and still find it.
In order to track down the problem, I enabled TRACE logging and get of course very much logging from JBoss, Seam, Hibernate. But for above method I only get the following:
[testng] FATAL [com.mytest.UserManagerImpl] removeUser [testng] DEBUG [org.jboss.seam.Component] instantiating Seam component: org.jboss.seam.core.interpolator [testng] DEBUG [org.jboss.seam.Component] initializing new instance of: org.jboss.seam.core.interpolator [testng] DEBUG [org.jboss.seam.Component] done [testng] FATAL [com.mytest.UserManagerImpl] DONE removeUser
Can anyone give me some hint whats going on or where to investigate further?
Environment:
Is your MyUser managed by the persistence context?
If not, try this:
public void removeUser(MyUser user) { log.fatal("removeUser"); em.remove(em.merge(user)); log.fatal("DONE removeUser"); user=null; }Fer ©
Yes, the MyUser instance should be managed by the persistence context (I just retrieve it in the statement before in the test routine).
Your suggested additional merge does not bring any cure. I am still investigating further but thanks meanwhile!