-
1. Re: EntityManager.persist saving to database but not updatin
bill.burke Aug 16, 2005 5:22 PM (in response to jeremyc)parameters are passed by value when invoking on remote interfaces. Your addFund method must return the id or return the full Fund object back to the client.
-
2. Re: EntityManager.persist saving to database but not updatin
jeremyc Aug 16, 2005 5:53 PM (in response to jeremyc)Ok, I changed my code to return the new Fund. But now I am having problems such as:
Fund fund = new Fund();
fund.setName("Jeremy");
fund.setGrowthrate(10);
fund = bank.addFund(fund);
System.out.println(fund.getId()); // Works!
fund.setName("John Doe");
bank.saveFund(fund); // simply calls em.persist(fund);
This happens:
Exception in thread "main" javax.ejb.EJBException: null; CausedByException is:
detached entity passed to persist: com.cowgar.learn.ejb3.task.ejbs.entity.Fund
How do I either keep from getting a detached entity or re-attach the entity?
Thanks,
Jeremy -
3. Re: EntityManager.persist saving to database but not updatin
bill.burke Aug 16, 2005 6:19 PM (in response to jeremyc)EntityManager.merge()
Don't be mad, but you are going to have to try out more examples if you want me to help you further. These are simple questions. -
4. Re: EntityManager.persist saving to database but not updatin
jeremyc Aug 16, 2005 7:01 PM (in response to jeremyc)Bill,
You are right. I will read more. I do wish that there was a tutorial. I have been going through the EJB 3.0 Trail Blazer and have not been having good much luck, but I will persist (he he) and make it through it, I hope.
I am glad that they are simple problems and not complex issues with how to work around this or that with JBoss :-)
Thanks,
Jeremy