-
Feb 7th, 2006, 07:11 AM
#1
A way to handle Hibernate's LazyLoading with remoting
Hello,
I’m not sure if what I’m going to ask belongs here, if it doesn’t please let me know where should I put it.
I’m looking for comments/suggestions on a problem I had and the solution I implemented.
The application I work on has a 3 tier architecture:
Eclipse RCP Client -- RMI --> Service Layer --> Dao Layer --> Hibernate --> DB
What was really annoying me was the “depth” level of the object graph I was fetching from the DB. For example, in some scenario I needed a customer with all its relations and in other scenario I just needed its name and address. Being a RMI “jump” away hibernate’s lazy loading didn’t work, and I didn’t want to provide lots of method in the service interface to control this parameter, but neither did I want to send unnecessary big objects through the network.
So what I did is to pass an Initializer from the client to the service layer to initialize the needed relations after the objects were retrieved from the DB, but before the transaction was commited. This extra parameter is passed as a Thread Local(client) - RemoteInvocation - Thread Local(server) attribute to avoid polluting the business interface.
I have left some details out to keep this post readable, so please ask if there’s anything missing.
Any comments will be greatly appreciated.
Regards,
Federico.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules