-->
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. Proxies: intercepting all method calls like JDK Proxies
PostPosted: Wed May 05, 2004 9:49 am 
Newbie

Joined: Wed May 05, 2004 9:31 am
Posts: 1
Hello,

I need to intercept method calls to my POJO's.

Therefore:
1. every POJO implements it's Interface which will be used for Interception via JDK Proxies.

2. POJO's can't be instanciated with new/ newInstance, instead one have to use a Factory which returns a JDK Proxy (java.lang.reflect.Proxy) which is bound to an Interceptor

3. the Interceptor (java.lang.reflect.InvocationHandler) handles method calls (via public Object invoke(Object proxy, Method method, Object[] args))

I'll use this for: Tracking/ Audit of method calls and declarative security checking (no I will not use EJB's...!)

This works fine but I have some doubts about this approach with Hibernate (my POJOS should be "Hibernated")

Hibernate has the Interceptor-Interface, but within this Interface I can't intercept (all) Method calls. What I need is something like public Object invoke(Object proxy, Method method, Object[] args)).

Question: Is there a "solution" for my problem? Can I extend the Interceptor for the required method, where to do it?

Regards,
Frank


Top
 Profile  
 
 Post subject:
PostPosted: Wed May 05, 2004 1:59 pm 
CGLIB Developer
CGLIB Developer

Joined: Thu Aug 28, 2003 1:44 pm
Posts: 1217
Location: Vilnius, Lithuania
I hope it is possible to use custom persister as factory, but I do not think it is a good idea to use proxies this way, It must be hard to debug and not very performant.


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.