Title: remoting hibernate

Hi list,

Before you stop reading: This is not about the LazyLoadingException :-)

I am writing framework code to expose simple crud-operations for use in a generic gui in both 2 and 3-tier environments (richclient). In doing so, I stumbled across a few problems that must pop up frequently, but I did not find readily applicable solutions. In particular, I'd like to ensure that the objects representing persisted objects on the client are unique, i.e. representatives should be shared among all gui components, enforcing agreement on the logical object's displayed state.

If hibernate were local, I'd simply use the hibernate session, but in the 3-tier scenario, it is remote (and sending the session over the wire might have far-reaching consequences). We are therefore considering to intercept access to hibernate, fixing mangled object identities on the client. This appears feasible, but duplicates quite a bit of hibernate's code, hence the following questions:

What is the intended approach for remoting hibernate in a rich-client? If I have to do this manually, is it feasible to decouple persistence logic from a hibernate session to get identity management only, permitting to move this "lightweight session" into the client tier? Or is it at least possible to reuse identity retrieval, proxy management or state copying [1] code from hibernate?

In case you are curious, my draft code for the manual solution is attached.

<<IdentityFixerPrototype.java>> <<HibernateProxyAwareIdentityFixerPrototype.java>>

What do you think?

Regards
Adrian Moos

[1] that is: to copy all state from one object onto another of the same type.

Attachment: IdentityFixerPrototype.java
Description: IdentityFixerPrototype.java

Attachment: HibernateProxyAwareIdentityFixerPrototype.java
Description: HibernateProxyAwareIdentityFixerPrototype.java

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
hibernate-devel mailing list
hibernate-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/hibernate-devel

Reply via email to