Hi,
I have a remote client using jndi (InitialContext) to grab remote interfaces of EJBs (I am using EJB3.0, so I am not talking about the home/remote difference, but I am grabbing the interface I have annotated as @Remote). If this client picks up an EntityManager with a standard persistence context, how should I put changes back to the server after changing the entity?
Currently I use:
mgr.merge( changedObject ); mgr.persist( changedObject );
What merge () does is - is to put back the detached entity back into persistence storage.
So if in yr case- if yr entity was detached it will put it back to persistence which means you don't have to call persist again.
For answer to part 2. - merge() method with throw an illegal Arguement Exception if its paramter is not an entity type.
I hope this helps....