[hibernate-dev] HHH-5562, services and eventlisteners

Emmanuel Bernard emmanuel at hibernate.org
Fri Feb 18 13:05:13 EST 2011


On Feb 17, 2011, at 7:22 PM, Steve Ebersole wrote:

> I see drawbacks to either approach. 
> 
> If the services can be shared across multiple SessionFactory instance then they *must* be stateless (or the state must be designed to be shared) which brings about portability/migration concerns.  Additionally consider the case of "configuring" services shared across multiple SessionFactory instances; for example imagine changing the option to enable sql logging on the JDBC Service.  Of course maybe that is what the user wants/intends so its nice from that perspective.
> 
Yes but at least intuitively, I think the more simple Service contract (ie allowed to keep direct state) is preferable to the extra flexibility.
> Really its a matter of the API for creating a SessionFactory.  This came up in the IRC meeting.  Its actually difficult to enforce that a ServiceRegistry only get used in a single SessionFactory.
> 
True.




More information about the hibernate-dev mailing list