code: public void setSessionFactory(SessionFactory sessionFactory) throws HibernateLayerException {
  		try {
  			this.sessionFactory = sessionFactory;
  			if (null != layerInfo) {
  				entityMetadata = sessionFactory.getClassMetadata(layerInfo.getFeatureInfo().getDataSourceName());
  			}
  		} catch (Exception e) { // NOSONAR
  			throw new HibernateLayerException(e, ExceptionCode.HIBERNATE_NO_SESSION_FACTORY);
  		}
  	}
docs: Set session factory.
  
  @param sessionFactory session factory
  @throws HibernateLayerException could not get class metadata for data source