Package org.hibernate.cfg

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


  @Override
  protected void doInitialise() throws ManagedLifecycleException {
    ArrayList<HibernateEventBean> eventList = new ArrayList<HibernateEventBean>();

    Configuration cfg = new Configuration();
    cfg.configure(m_cfgFile);

    // Need to loop through messagefilters and add them as interceptors
    for (ConfigTree ct : m_config.getChildren(MESSAGE_FILTER)) {
      try {
        String tempEvent = ListenerUtil.getValue(ct, HibernateEpr.EVENT_TAG, null);
View Full Code Here


        if ("sessionFactory".equals(beanName) && bean instanceof LocalSessionFactoryBean) {
            try {
                LocalSessionFactoryBean sessionFactory = (LocalSessionFactoryBean) bean;

                Configuration cfg = new Configuration();
                cfg.configure();

                // load all mappings
                Resource[] resources = applicationContext
                        .getResources("classpath*:mappings.hbm.xml");
                for (Resource resource : resources) {
View Full Code Here

        }
        if (configuration==null) {
          String errorMessage = getText("hibernateplugin.configurationType_error");
          throw new Exception(errorMessage);
        }
        configuration.configure(file);
        Properties propertiesAll = configuration.getProperties();
        Properties properties = new Properties();
        for (Object key:propertiesAll.keySet()) {
          if (key.toString().startsWith("hibernate"))
            properties.put(key, propertiesAll.get(key));
View Full Code Here

      log.debug("Full Hibernate Plugin's Session Factory using Hibernate Annotation Configuration");
    } catch (Exception e) {
      configuration = new Configuration();
      log.debug("Full Hibernate Plugin's Session Factory using Hibernate XML Configuration");
    }
    configuration.configure(file);
    log.debug("Full Hibernate Plugin's Session Factory configuration file \""+file+"\" configured");
   
    String fileProperties = file.substring(1,file.length()).replace(".cfg", "").replace("xml", "properties");
    Resource resource = new Resource(fileProperties);
    if (resource.getURL()!=null) {
View Full Code Here

public class SchemaUpdater {
  private static final Log logger = LogFactory.getLog(SchemaUpdater.class);

  public static void main(String[] args) {
    Configuration config = new Configuration();
    config.configure();
    SchemaUpdate su = new SchemaUpdate(config);
    su.execute(true, true);
  }
}
View Full Code Here

  }


  private static void update() {
    Configuration config = new Configuration();
    config.configure();
    SchemaUpdate su = new SchemaUpdate(config);
    su.execute(true, true);
  }
}
View Full Code Here

     * @return
     * @throws HibernateException
     */
    private static SessionFactory configureSessionFactory() throws HibernateException {
        Configuration configuration = new Configuration();
        configuration.configure();
        sessionFactory = configuration.buildSessionFactory();
        return sessionFactory;
    }
}

View Full Code Here

      }

      if (this.configLocations != null) {
        for (Resource resource : this.configLocations) {
          // Load Hibernate configuration from given location.
          config.configure(resource.getURL());
        }
      }

      if (this.hibernateProperties != null) {
        // Add given Hibernate properties to Configuration.
View Full Code Here

  @Override
  public void loadConfiguration() throws SessionFactoryConfigurationException {
    try {     
      Configuration config = new Configuration();
      config.configure(this.getResource());
      String batchSize = config.getProperty("hibernate.jdbc.batch_size");
      Integer batchSizeNumber = Integer.valueOf(batchSize);
      this.setBatchSize(batchSizeNumber.intValue());
     
      ServiceRegistry registry = new ServiceRegistryBuilder().applySettings(config.getProperties()).buildServiceRegistry();
View Full Code Here

      throw new SessionFactoryConfigurationException(msg.toString());
    }
   
    try {     
      Configuration config = new Configuration();
      config.configure(this.file);
      String batchSize = config.getProperty("hibernate.jdbc.batch_size");
      Integer batchSizeNumber = Integer.valueOf(batchSize);
      this.setBatchSize(batchSizeNumber.intValue());
     
      ServiceRegistry registry = new ServiceRegistryBuilder().applySettings(config.getProperties()).buildServiceRegistry();
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.