-->
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.  [ 3 posts ] 
Author Message
 Post subject: EntityListener Annotation + IOC
PostPosted: Fri Nov 03, 2006 6:50 am 
Newbie

Joined: Thu Nov 02, 2006 6:59 pm
Posts: 8
Location: London
Hibernate version: 3.2

I posted this on the hibernate user forum, but it probably belongs here...

For using EntityListeners the code would look something like this...

Code:
@Entity
@EntityListener (MyListener.class)
public class SomeEntity {
    //irrelevant implementation
}


My Question is how do I make it so that the MyListener.class is an interface, with the implementation class determined by Dependency Injection?

Basically, I want the EntityListener to be loaded via Spring,

Thanks

Grant


Top
 Profile  
 
 Post subject:
PostPosted: Fri Nov 03, 2006 5:53 pm 
Newbie

Joined: Fri Nov 03, 2006 10:01 am
Posts: 6
There isn't a simple solution to this, that I'm aware of.

The best thing I can think of is to create a spring managed bean that will perform the logic you want the entity listener to do. Then have your Entity Listener class get a reference to the ApplicationContext and get a spring-managed bean and invoke it.

Hth,
Adam


Top
 Profile  
 
 Post subject: Managed Bean
PostPosted: Sat Nov 04, 2006 4:44 am 
Newbie

Joined: Thu Nov 02, 2006 6:59 pm
Posts: 8
Location: London
Thanks - thats about the best I could do. Seeems there is no way to dependency manage what goes into your annotations - this is probably a good thing.


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