-->
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.  [ 6 posts ] 
Author Message
 Post subject: Hibernate Listeners Configuration in Hibernate MBean
PostPosted: Fri Jun 03, 2005 9:29 pm 
Newbie

Joined: Fri Jun 03, 2005 9:03 pm
Posts: 5
Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp

Hibernate version:3.0.2

JBoss version: 4.0.2

Hi all,

first post, so please be kind :-)

I have a problem that I need to solve: I need to catch exceptions thrown at at flush time by the Hibernate Session. I am using the JBoss, JTA transactions, Hibernate MBean technology stack, therefore, the exception is thrown when the transaction commits.
I was trying to implement a solution that uses Hibernate Listeners. My idea was to connect a listener to the flush event, and catch the exception there. However, I have been looking for a while at the documentation, but I could not find a way to configure the JBoss Hibernate MBean so that it attaches the listeners to the Configuration objects before the SessionFactory is created.
Any idea? Am I missing something here?

Thank you very much for any help!
Marco


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jul 25, 2005 3:35 pm 
Regular
Regular

Joined: Tue Mar 22, 2005 2:27 am
Posts: 62
FYI, I asked a similar question on the Jboss user forums... no answer as of yet.
Here's the link, in case you want to watch for an answer there as well:

http://www.jboss.com/index.html?module= ... ic&t=66557


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jul 26, 2005 3:27 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 3:00 pm
Posts: 1816
Location: Austin, TX
That capability does not yet exist, though I have been thinking about it. I'd really like to wait until the JBoss micro container is complete before tackling this. This is because, to me at least, simply specifying the listener class to use to respond to various events is not nearly as useful as the ability to specify the exact instances to use (so they can collaborate, etc).

One potential interim solution would be something like adding an interface that users can implement and then register with the MBean. The interface impl would be responsible for telling the MBean the listeners to use. Maybe something like:
Code:
public interface ListenerProducer {
    /**
     * Produce a map of listener instances, keyed
     * by the "event type".
     */
    public Map produceListeners();
}


The MBean would then have a ListenerProducerImpl managed attribute, which would name the impl class. The MBean would instantiate it and iterate the return from produceListeners(), registering each indicated listener with the Configuration prior to building the SF.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jul 28, 2005 1:15 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 3:00 pm
Posts: 1816
Location: Austin, TX
FYI:
http://jira.jboss.com/jira/browse/HIBERNATE-17


Top
 Profile  
 
 Post subject:
PostPosted: Tue Aug 09, 2005 2:19 am 
Newbie

Joined: Fri Jun 03, 2005 9:03 pm
Posts: 5
Thank you Steve! I will try to implement an AOP approach.
Thanks again, and I am waiting for listener configuration as soon as possible. Actually, is there anything I can do to help?


Top
 Profile  
 
 Post subject:
PostPosted: Tue Aug 09, 2005 9:49 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 3:00 pm
Posts: 1816
Location: Austin, TX
Have you looked at the jira case linked above?!?

This is already implemented.


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