-->
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: aspected model classes
PostPosted: Sat Jul 31, 2004 7:26 pm 
Beginner
Beginner

Joined: Wed Jul 21, 2004 12:28 pm
Posts: 27
Location: New York
I was looking for a way to aspectize my model objects.

One way I found is thru AspectJ, but ... it would not play well with IoC container like Spring for example. Which is one of the big reasons I do not like the solution.

What I was thinking is that I can set the class to be proxied, but is there a way to provide a proxy factory to generate that proxy whenever hibernate needs to create an object/proxy of the class?

Or maybe there is a better way of doing it?

_________________
Thanks,
Alex


Top
 Profile  
 
 Post subject:
PostPosted: Sat Sep 04, 2004 2:57 am 
Newbie

Joined: Sat Sep 04, 2004 2:41 am
Posts: 2
I too have been thinking about how to address this problem. While people may have performance concerns, I would like to try using Spring's AOP capabilities to proxy all(?) of my objects.

Ideally, we would modify the Hibernate code and somehow have it get instances of model beans from Spring's bean factory instead of using "new". I hope that Gavin and Rod are thinking about how this could be accomplished. :)

For the time being, I have come up with a solution that I think could be workable. Let's assume that you have your POJO model bean defined in Spring IoC with some AOP interceptors. I think you can use the delegate pattern...

Code:
public class SpringAopProxyModelBean
{
  private static final ApplicationContext APPCTX;

  static
  {
    APPCTX = null; // get a reference to the Spring AppContext
  }

  private ModelBean modelBean = APPCTX.getBean("modelBean");
 
  public String getId()
  {
    return modelBean.getId();
  }
 
  public void setId(String id)
  {
    modelBean.setId(id);
  }
}


L


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.