@ Override public SessionFactory provide ( ) { logger . trace ( "Creating hibernate session factory." ) ; // Build the service registry. SessionFactory factory = new MetadataSources ( serviceRegistry ) . buildMetadata ( ) . buildSessionFactory ( ) ; // Register our event listeners. injectEventListeners ( ( ( SessionFactoryImpl ) factory ) . getServiceRegistry ( ) ) ; return factory ; }
Provide a singleton instance of the hibernate session factory .