-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: How to use hibernate remotely?
PostPosted: Tue Jun 12, 2007 12:02 am 
Newbie

Joined: Thu Jan 11, 2007 9:01 pm
Posts: 2
Hi everyone.

I have been using Hibernate locally with no issue. Now I need to use that in a (fat) client/server paradigm as described briefly below:

I have a fat client that has certain logic in it. Persistence happens on the server (backed by a DB). Communication between the two is through web services. Let say I have a class called Person and it has a reference to an object of another class Address. Lets say that each class has a (Long) id attribute as its unique identifier (which is mapped to the PK in the DB)

In the local version (no server, i.e. all happening by client and DB is local, too), I was using cascading to enforce the persistence of Address (and many other referenced objects) when I was saving Person. In the client/server situation, I create Person and Address objects on the client side and issue a local "save" which in effect sends them over to the server to be persisted there but the issue that I see is the following: the (client) save method call invokes the server's "save" method and all is good on the server (i.e. Person's persistence enforces the persistence of Address through cascading style) but the id's created on the server are not passed back to client, so on the client side, after "saving" Person, it won't have its id populated with the value from the server (i.e. DB) so if I make another change to Person (or Address) and save them again, it creates new entries in the DB. I can return the id back to the client when I do a save on the server for, say, Person objects and manually set the client's version of Person to have the same id but the issue is that manually finding all referenced objects (Address and the like) and setting their id's on the client side is not a reasonable solution.

What do people do in these cases?

Many thanks
Ali.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.