-->
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.  [ 5 posts ] 
Author Message
 Post subject: How does hibernate intercept POJO method calls?
PostPosted: Tue Jan 24, 2006 1:35 pm 
Newbie

Joined: Tue Jan 10, 2006 10:00 am
Posts: 5
I have a non-bibernate but interesting java question that hibernate developers could probably answer..

Basically, I want to intercept method calls on normal java beans at run time and map these to changes in a GUI and vice/versa in a generic reusable manner. This would save me a lot of development time as most of the code in a gui is mapping properties of objects in the application model to fields on a GUI. I would rather just register the beans and gui field handlers with a mapper utility would reflect changes in both directions.

As a first thought, I expected to be able to use dynamic proxies for this, however, it seems that this is only good for interface based classes and I cannot guarantee that the POJOs I will have to map have been created this way.

After using hibernate a little (very little) I realised that hibernate developers must have a clever solution for this problem as hibernate does not require my POJOs to have equivalent interfaces.

Could some kind developer please enlighten me about creating non-interface based proxies?


Top
 Profile  
 
 Post subject: CGLib
PostPosted: Tue Jan 24, 2006 2:56 pm 
Expert
Expert

Joined: Fri Jul 22, 2005 2:42 pm
Posts: 670
Location: Seattle, WA
CGLib allows that
http://cglib.sourceforge.net/

see my example of using CGLib here
http://sandbox.sourcelabs.com/kosta/hb- ... /haop.html

Or you can use full AOP system like AspectJ
http://www.eclipse.org/aspectj/

_________________
--------------
Konstantin

SourceLabs - dependable OpenSource systems


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jan 24, 2006 3:58 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
yes, cglib is the one we use in hibernate as we only need a little fragment of "aop" functionallity.

I would recommend that you looked into using something more complete more maintainable and much better documented such as JBoss AOP

/max

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jan 25, 2006 2:37 am 
CGLIB Developer
CGLIB Developer

Joined: Thu Aug 28, 2003 1:44 pm
Posts: 1217
Location: Vilnius, Lithuania
Yes, cglib is designed for framework developers (and it is tuned for hibernate) it must be better to use AOP framework for application development.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jan 27, 2006 11:24 am 
Newbie

Joined: Tue Jan 10, 2006 10:00 am
Posts: 5
Thank you all.

I too only want a small fragment of functionality to build a GUI to JavaBean property mapping tool so will take a look at CGlib rather than a full aspect oriented system. I just keep finding myself writing too much code to simply cross wire beans and fields on the GUI. I would rather spend the time writing a useful tool than lots of boring GUI code!


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 5 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.