Package org.hibernate.cfg

Examples of org.hibernate.cfg.Configuration.buildSessionFactory()


          .configure("dne.hibernate.mappings.xml")
          .configure(configFile)
          ;
        ServiceRegistryBuilder serviceRegistryBuilder = new ServiceRegistryBuilder()
          .applySettings(config.getProperties());
        this.customFactory = config.buildSessionFactory(serviceRegistryBuilder.buildServiceRegistry());
      } catch (Exception ex) {
        LOG.error("Um erro ocorreu ao tentar estabelecer a conexão com a DNE pelo arquivo: "
          +configFile,ex);
        LOG.info("Inicializando a DNE sem conexão com o banco de dados devido à erros.");
        this.customFactory = null;
View Full Code Here


   
    if (configuration==null) {
      throw new WireException("couldn't find configuration");
    }

    SessionFactory sessionFactory = configuration.buildSessionFactory();
   
    wireContext.addListener(new SessionFactoryCloser(sessionFactory));

    return sessionFactory;
  }
View Full Code Here

        for (HibernateConfigurer configurer : hibernateConfigurers)
            configurer.configure(configuration);

        long configurationComplete = System.currentTimeMillis();

        sessionFactory = configuration.buildSessionFactory();
        this.configuration = new ImmutableConfiguration(configuration);

        long factoryCreated = System.currentTimeMillis();

        logger.info(HibernateCoreMessages.startupTiming(
View Full Code Here

  public static void main(String[] args) {
    Configuration cfg = new Configuration();
   
    cfg.configure("/hibernate.cfg.xml");
   
    SessionFactory factory = cfg.buildSessionFactory();
   
    Session session = factory.openSession();
   
    Map allClassMetadata = factory.getAllClassMetadata();
   
View Full Code Here

    Configuration conf = new Configuration();
    String resource = "it/eng/spagobi/tools/importexport/metadata/hibernate.cfg.hsql.export.xml";
    conf = conf.configure(resource);
    String hsqlJdbcString = "jdbc:hsqldb:file:" + pathDBFolder + "/metadata;shutdown=true";
    conf.setProperty("hibernate.connection.url",hsqlJdbcString);
    SessionFactory sessionFactory = conf.buildSessionFactory();
    logger.debug("OUT");
    return sessionFactory;
  }
 
 
View Full Code Here

    Configuration conf = new Configuration();
    String resource = "it/eng/spagobi/tools/importexport/metadata/hibernate.cfg.hsql.export.xml";
    conf = conf.configure(resource);
    String hsqlJdbcString = "jdbc:hsqldb:file:" + pathDBFolder + "/metadata;shutdown=true";
    conf.setProperty("hibernate.connection.url",hsqlJdbcString);
    SessionFactory sessionFactory = conf.buildSessionFactory();
    logger.debug("IN");
    return sessionFactory;
  }

View Full Code Here

      //creating configuration object 
      Configuration cfg=new Configuration()
      cfg.configure("hibernate.cfg.xml");//populates the data of the configuration file 
       
      //creating seession factory object 
      SessionFactory factory=cfg.buildSessionFactory()
       
      //creating session object 
      Session session=factory.openSession()
       
      //creating transaction object 
View Full Code Here

      throws HibernateException {
    Configuration configuration = new Configuration();
    configuration.configure("hibernate_sp.cfg.xml");
    ServiceRegistryBuilder serviceRegistryBuilder = new ServiceRegistryBuilder()
        .applySettings(configuration.getProperties());
    sessionFactory = configuration
        .buildSessionFactory(serviceRegistryBuilder
            .buildServiceRegistry());
    return sessionFactory;
  }
View Full Code Here

      compositeHibernateConfiguration.addJar(configuration.getFile());
    } catch (Throwable t) {
      throw new RuntimeException("Cannot add datamart", t);
    }
   
    sf = cfg.buildSessionFactory();
    sessionFactoryMap.put(configuration.getModelName(), sf);   
  }
 
  @Override
  public IModelStructure getModelStructure() {
View Full Code Here

      compositeHibernateConfiguration.addJar(configuration.getFile());
    } catch (Throwable t) {
      throw new RuntimeException("Cannot add datamart", t);
    }
   
    sf = cfg.buildSessionFactory();
    sessionFactoryMap.put(configuration.getModelName(), sf);   
  }
 
  private ConnectionDescriptor getConnection() {
    ConnectionDescriptor connection = (ConnectionDescriptor)configuration.loadDataSourceProperties().get("connection");
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.