Results 1 to 2 of 2

Thread: Cannot make remote Hibernate objects persisted over RMI

  1. #1
    Join Date
    Sep 2004
    Posts
    1

    Default 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. #2
    Join Date
    Aug 2004
    Location
    Brno, Czech Republic
    Posts
    48

    Default

    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...20 Invocation

    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

Similar Threads

  1. Hibernate Long Session Per Flow?
    By akw in forum Web Flow
    Replies: 21
    Last Post: Dec 12th, 2005, 08:06 PM
  2. Replies: 8
    Last Post: Jul 29th, 2005, 06:40 PM
  3. Replies: 5
    Last Post: Apr 12th, 2005, 05:23 PM
  4. Replies: 3
    Last Post: Nov 19th, 2004, 07:16 PM
  5. How to make domain model objects observables ?
    By baptiste in forum Architecture
    Replies: 1
    Last Post: Nov 15th, 2004, 08:55 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •