Announcement Announcement Module
Collapse
No announcement yet.
Cannot make remote Hibernate objects persisted over RMI Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Cannot make remote Hibernate objects persisted over RMI

    Hi,

    I'm using the spring framework, RMI invoker and Hibernate. I'm new at the subject. I'm having a problem. Here is the scenerio:

    I expose a service class with RMI to the client. In this service class I create new objects and I tell my service class too save them through hibernate but they don't receive their id back.

    Any ideas?

    Thanks in advance,
    Ray

  • #2
    Ray,

    you must consider that the remote call attributes are "passed by value" (serialized and recreated on the remote side) so their change of state cannot be visible on the client side. See this article for nice explanation of this:
    http://javadude.com/articles/passbyv...d%20Invocation

    At the bottom of the page there is a note about RMI.

    I think that in your case you have something like this in your Remote interface:

    public void saveMyObject(MyObject objectToBeSaved) throws RemoteException;

    but you should use this instead:

    public MyObject saveMyObject(MyObject objectToBeSaved) throws RemoteException

    => return the instance after save (with its Id)

    HTH,
    Karel

    Comment

    Working...
    X