-->
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: Hibernate + Spring + AOP
PostPosted: Mon May 05, 2008 2:32 pm 
Newbie

Joined: Fri Apr 25, 2008 3:02 pm
Posts: 2
Hi, I wanna know if there's some sort of specific configuration i need to add so that Hibernate will use Spring's BeanFactory to instantiate the Beans I retrieve from my DataBase. The things is i defined some AOP config to log whenever some methods are called but right now the Beans I get from hibernate are not decorated and therefor it's not logging.

Thnx.

Sorry about the rough english, I'm Argentinian and my english is a bit rusty


Top
 Profile  
 
 Post subject: Re: Hibernate + Spring + AOP
PostPosted: Mon May 05, 2008 5:53 pm 
Expert
Expert

Joined: Wed Apr 11, 2007 11:39 am
Posts: 735
Location: Montreal, QC
Use a hibernate interceptor. This is the method you need to implement (this is the original body from hibernate code):

Code:
   /**
    * Instantiate the entity class. Return <tt>null</tt> to indicate that Hibernate should use
    * the default constructor of the class. The identifier property of the returned instance
    * should be initialized with the given identifier.
    *
    * @param entityName the name of the entity
    * @param entityMode The type of entity instance to be returned.
    * @param id the identifier of the new instance
    * @return an instance of the class, or <tt>null</tt> to choose default behaviour
    */
   public Object instantiate(String entityName, EntityMode entityMode, Serializable id) throws CallbackException;




Farzad-


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.