I'm trying to remote the functionality of the Hibernate Session over RMI.
I've got a RemoteSession which implements the Session interface, and delegates to a remote Session via RMI.
First of all keep in mind any time you move an object over RMI, your making copies of it. Therefore you gotta get fancy with evicting and locking things as they come in and go out across the wire. This isn't the most sexy thing you've ever seen, but it can be done.
The problem lies with Lazily Loaded collections.
The PersistentCollection maintains a transient reference to the Session. Therefore the act of loading it over the wire gaurentees you'll loose your reference to the Session.
Locking it using the Session dosn't solve the problem, because a (fresh) copy of the object is locked on the Server (requiring you to evict the inital copy), but the copy on the client can't possibly benifit from that.
What I -really- want to do is associate the client side RemoteSession (implements Session) with the PersistentCollection. Is there an elegant way of doing this? Is there a way to 'load' all lazily loaded collections (besides marking them lazy="false")? Is there another solution I havn't considered?
Thanks in advance!
-Travis <tsavo@ifilm.com>
|