-->
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.  [ 2 posts ] 
Author Message
 Post subject: Hib Gurus: Can anyone explain CGLib proxy lifecycle/access?
PostPosted: Fri Feb 24, 2006 4:04 am 
Newbie

Joined: Thu Jan 05, 2006 7:33 pm
Posts: 13
At the risk of oversimplifying the issue can anybody with a good understanding of the CGLib runtime proxies explain, from a Hibernate users perspective, the:

1) proxy lifecycle. Eg When are they created and returned, where are they stored and when are they replaced by the persistent entities they are proxying for.

and

2) proxy access sequence flow - eg. when a proxy is called, how is the call handled and how does it get to the target class / db etc

This is a mammoth topic and Im only after a 5 line summary of each. I have looked quite thoroughly through the site over the last few months and on this topic in the last week or so but this seems to a lightly documented topic at best with only some hints spread throughout the FAQs and online docs. I am really interested in understanding, to a shallow level at least, what happens.

******************************
Something like the following would be greatly appreciated (this is not accurate!!!!)

*****EXAMPLE 1*******
A call to session.load creates a proxy if there is none but doesnt initialize it, pulls it from the cache if one exists.
Any call to a proxy method hits the db and initializes the proxy with the db values.
Any call to a fully initialized instance that returns a hibernate mapped entity DOESNT return an instance, it returns a proxy as above. etc...


******** EXAMPLE 2 *************
Proxy creation - when a proxy is first created, it only knows its id and mapped class (highest in the hierarchy). This is also known as UNITIALIZED.

When a proxy method is called it is then INITIALIZED. This means that state is loaded into its properties from the DB. This is now a 'normal' JVM instance.

....

Sorry for the bizarre request and any and all help is very much appreciated!

cheers

Michael


Top
 Profile  
 
 Post subject:
PostPosted: Fri Feb 24, 2006 6:07 am 
CGLIB Developer
CGLIB Developer

Joined: Thu Aug 28, 2003 1:44 pm
Posts: 1217
Location: Vilnius, Lithuania
In short client code must not assume entity is proxy or not


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

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.