users@glassfish.java.net

Re: EJB3 CMP TOPLINK BUG

From: <glassfish_at_javadesktop.org>
Date: Sun, 25 Mar 2007 03:24:41 PST

Since i did not found a way to upload my example i have uploaded it to:
ftp://gilmichlin.awardspace.com , user:gilmichlin_java pass:java
just rename the EJBModuleTest.rar.txt to RAR.

the issue:
I have a session bean which call Facade (with both remote and local interfaces )
I am calling the session via remote (test client ).

now for the problem:
 if the session is calling Facade via Local interface , everything
works fine , on Remote interface when i try to delete i will get the following error:

"javax.ejb.TransactionRolledbackLocalException: Exception thrown from bean; nested exception is: java.lang.IllegalArgumentException: Entity must be managed to call remove: com.pre.Account[accountId=1], try merging the detached and try the remove again"

I have managed to fix that by changing the destroy:
  public void destroy(Account account) {
   // em.merge(account);
   // em.remove(account);
        em.remove( em.merge(account)); //WORKAROUND FOR REMOTE
    }

I am currently using VWP which call EJB and I am using REMOTE call in session to Facade because of:
http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6497261
[Message sent by forum member 'gilmichlin' (gilmichlin)]

http://forums.java.net/jive/thread.jspa?messageID=209766