0

I have a remove method in an EJB as below

@Override
public void remove(Project project)
{
    em.remove(em.merge(project));
}

The project I pass has been retrieved from another class as shown below:

try
 {
        Project tmpProject = getProjectEJB().getById(projectId);
        getProjectEJB().remove(tmpProject);
 }
 catch (Exception ex)
 {..}

the result of the remove is that is doesn't remove the object (which is quite reasonable in itself because Project has several relationships pointing to it) what I can't understand is why JPA doesn't return any error but simply silently fails.

dendini
  • 3,842
  • 9
  • 37
  • 74
  • do you have any logs ? – willome Jan 23 '14 at 11:03
  • I am debugging this under Netbeans and all logs are shown, this particular method however doesn't return any error, it simply correctly executes. If I put a catch for an Exception no exception is returned. – dendini Jan 23 '14 at 12:46
  • Is the EntityManager joined to a transaction? SQL is only issued on commit or flush – Chris Jan 23 '14 at 13:44
  • show_sql to true ?, you can see any query related to the operation of delete the entity ? – Koitoer Jan 24 '14 at 06:49
  • @Chris **Is the EntityManager joined to a transaction?** how do I find that out? the entity manager is working fine for many other classes.. – dendini Jan 28 '14 at 13:36
  • Try calling em.flush(), and post how you are creating transactions. This should show in the logs as well. – Chris Jan 28 '14 at 13:57

0 Answers0