Package org.hibernate.cfg

Examples of org.hibernate.cfg.Configuration$MappingsImpl$TableColumnNameBinding


    return ArrayHelper.toStringArray(files);
  }

  private Configuration getConfiguration() throws Exception {
    Configuration cfg = new Configuration();
    if (namingStrategy!=null) {
      cfg.setNamingStrategy(
          (NamingStrategy) ReflectHelper.classForName(namingStrategy).newInstance()
        );
    }
    if (configurationFile != null) {
      cfg.configure( configurationFile );
    }

    String[] files = getFiles();
    for (int i = 0; i < files.length; i++) {
      String filename = files[i];
      if ( filename.endsWith(".jar") ) {
        cfg.addJar( new File(filename) );
      }
      else {
        cfg.addFile(filename);
      }
    }
    return cfg;
  }
View Full Code Here


    return (StandardServiceRegistryImpl) new StandardServiceRegistryBuilder().applySettings( properties ).build();
  }

  public static void main(String[] args) {
    try {
      Configuration cfg = new Configuration();

      boolean script = true;
      // If true then execute db updates, otherwise just generate and display updates
      boolean doUpdate = true;
      String propFile = null;

      for ( int i = 0; i < args.length; i++ ) {
        if ( args[i].startsWith( "--" ) ) {
          if ( args[i].equals( "--quiet" ) ) {
            script = false;
          }
          else if ( args[i].startsWith( "--properties=" ) ) {
            propFile = args[i].substring( 13 );
          }
          else if ( args[i].startsWith( "--config=" ) ) {
            cfg.configure( args[i].substring( 9 ) );
          }
          else if ( args[i].startsWith( "--text" ) ) {
            doUpdate = false;
          }
          else if ( args[i].startsWith( "--naming=" ) ) {
            cfg.setNamingStrategy(
                ( NamingStrategy ) ReflectHelper.classForName( args[i].substring( 9 ) ).newInstance()
            );
          }
        }
        else {
          cfg.addFile( args[i] );
        }

      }

      if ( propFile != null ) {
        Properties props = new Properties();
        props.putAll( cfg.getProperties() );
        props.load( new FileInputStream( propFile ) );
        cfg.setProperties( props );
      }

      StandardServiceRegistryImpl serviceRegistry = createServiceRegistry( cfg.getProperties() );
      try {
        new SchemaUpdate( serviceRegistry, cfg ).execute( script, doUpdate );
      }
      finally {
        serviceRegistry.destroy();
View Full Code Here

    //processes specific properties
    List<String> jaccKeys = new ArrayList<String>();


    Configuration defaultConf = new AnnotationConfiguration();
    Interceptor defaultInterceptor = defaultConf.getInterceptor();
    NamingStrategy defaultNamingStrategy = defaultConf.getNamingStrategy();

    Iterator propertyIt = preparedProperties.keySet().iterator();
    while ( propertyIt.hasNext() ) {
      Object uncastObject = propertyIt.next();
      //had to be safe
View Full Code Here

  private transient ClassLoader overridenClassLoader;
  private boolean isConfigurationProcessed = false;


  public Ejb3Configuration() {
    cfg = new Configuration();
    cfg.setEntityNotFoundDelegate( ejb3EntityNotFoundDelegate );
  }
View Full Code Here

    /*
     * FIXME: takie wyciaganie propertiesow powoduje niepotrzebne
     * ladowanie konfiguracji hibernate trzebna przerobic i wczytac plik
     * hibernate.cfg.xml jako zwyklego xml
    */
    String databaseURL = new Configuration()
    .configure("pl/zgora/uz/wmie/fe/config/hibernate.cfg.xml").getProperty("connection.url");
    if (databaseURL == null) {
      databaseURL = new Configuration().configure(
          "pl/zgora/uz/wmie/fe/config/hibernate.cfg.xml")
          .getProperty("hibernate.connection.url");
    }
    Connection jdbcConnection = DriverManager.getConnection(
        databaseURL, "sysdba",
View Full Code Here

 
  @Override
  protected void configureHibernate(@SuppressWarnings("deprecation") org.hibernate.cfg.AnnotationConfiguration ac) {
    super.configureHibernate(ac);
   
    Configuration c = ac;
    TagService.configureTagClasses(c);
    c.addAnnotatedClass(org.cast.isi.data.ISIEvent.class);
    c.addAnnotatedClass(org.cast.isi.data.ISIResponse.class);
    c.addAnnotatedClass(org.cast.isi.data.SectionStatus.class);
    c.addAnnotatedClass(org.cast.isi.data.ClassMessage.class);
    c.addAnnotatedClass(org.cast.isi.data.StudentFlag.class);
    c.addAnnotatedClass(org.cast.isi.data.FeedbackMessage.class);
    c.addAnnotatedClass(org.cast.isi.data.WordCard.class);
    c.addAnnotatedClass(org.cast.isi.data.ISIPrompt.class);
    c.addAnnotatedClass(org.cast.isi.data.ContentElement.class);
    c.addAnnotatedClass(org.cast.isi.data.Question.class);
  }
View Full Code Here

  /**
   * @param args
   * @throws Exception
   */
  public static void main(String[] args) throws Exception {
    Configuration configure = new Configuration()
        .configure("pakiet/hibernate.cfg.xml");
    // configure.setInterceptor(new Interceptor());
    // configure.getEventListeners().setPreUpdateEventListeners(
    // new PreUpdateEventListener[] { new PreUpdateListener() });
    // configure.getEventListeners().setLoadEventListeners(
    // new LoadEventListener[] { new LoadListener(),
    // new DefaultLoadEventListener() });
    final SessionFactory sessionFactory = configure.buildSessionFactory();
    // Session session = sessionFactory.openSession();
    // Transaction transaction = session.beginTransaction();
    // session.createQuery("from Stanowisko").list();
    // Stanowisko s = (Stanowisko) session.load(Stanowisko.class, 1);
    // s.setNazwa(System.currentTimeMillis() + " miro");
View Full Code Here

      return (MetadataImplementor) sources.buildMetadata();
  }

  // TODO: is this still needed?
  protected Configuration buildConfiguration() {
    Configuration cfg = constructAndConfigureConfiguration();
    afterConstructAndConfigureConfiguration( cfg );
    return cfg;
  }
View Full Code Here

    afterConstructAndConfigureConfiguration( cfg );
    return cfg;
  }

  private Configuration constructAndConfigureConfiguration() {
    Configuration cfg = constructConfiguration();
    configure( cfg );
    return cfg;
  }
View Full Code Here

    applyCacheSettings( cfg );
    afterConfigurationBuilt( cfg );
  }

  protected Configuration constructConfiguration() {
    Configuration configuration = new Configuration()
        .setProperty(Environment.CACHE_REGION_FACTORY, CachingRegionFactory.class.getName()  );
    configuration.setProperty( AvailableSettings.USE_NEW_ID_GENERATOR_MAPPINGS, "true" );
    if ( createSchema() ) {
      configuration.setProperty( Environment.HBM2DDL_AUTO, "create-drop" );
    }
    configuration.setProperty( Environment.DIALECT, getDialect().getClass().getName() );
    return configuration;
  }
View Full Code Here

TOP

Related Classes of org.hibernate.cfg.Configuration$MappingsImpl$TableColumnNameBinding

Copyright © 2018 www.massapicom. 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.