Provide a sessionFactory close event or hook for the event listeners

Description

It can be done either:

  • as an event/eventListener

  • as a method that eventlisteners implement (symmetric of initialize())

The former being more flexible

Environment

None

Activity

Show:
Anirudh Vyas
February 6, 2008, 6:12 PM

Copied this from Documentation on Events comment, as i thought it'd be more appropriate.

Hi,

Hibernate Event System lacks documentation as well as some of the parts ( or i think so, correct me if i go wrong somewhere ).

In the Event System ( for example OnSaveOrUpdateEvent )
It would be appropriate to move all the Event delegation based code to an Event Delegate which has all the listeners registered to it and then use a Broadcast agent to do broadcast ( or Fire an event in Hibernate Terminology ) the events and loop through listeners to check.

something like :

// fire the event
SessionImpl.broadcastSaveEvent( SaveEvent( Phase.SAVE, Source etc etc ) , BaseEventDelegate );

// use a BroadCast interface and implement a DefaultBroadcastAgent and do something like
DefaultBroadcastAgent.processBroadcast( BaseEventDelegate )

// broadcaster above uses event delegate passed to it to loop through listeners.
// same as in SessionImpl.

we could also check if listeners passed to this was an appropriate listener or not.

Let me know in case you need more clarifications.
Regards
Vyas, Anirudh

Steve Ebersole
March 21, 2011, 7:04 PM

Bulk closing stale resolved issues

Assignee

Steve Ebersole

Reporter

Emmanuel Bernard

Fix versions

Labels

None

backPortable

None

Suitable for new contributors

None

Requires Release Note

None

Pull Request

None

backportDecision

None

Components

Priority

Major
Configure