public static SessionFactory getSessionFactory(String sessionFactoryName) throws SessionFactoryNotFoundException {
if (factoriesMap.isEmpty())
return null;
SessionFactory sessionFactory = factoriesMap.get(sessionFactoryName);
if (sessionFactory==null)
throw new SessionFactoryNotFoundException("No SessionFactory named \""+sessionFactoryName+"\" found. You should use "+factoriesMap.keySet());
return sessionFactory;
}