Package org.hibernate.cfg

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


        } // end if..else
       
        cfg.setProperty("hibernate.dialect", hibernateDialect);
       
        for (String resource : mappingResources) {
            cfg.addResource(resource);
        } // end for
       
        logger.info("begin database schema creation =========================");
        new SchemaUpdate(cfg).execute(true, true);
        logger.info("end database schema creation ===========================");
View Full Code Here


      envProps.put(AvailableSettings.JTA_PLATFORM, new JBossStandAloneJtaPlatform());
      serviceRegistry = ServiceRegistryBuilder.buildServiceRegistry(envProps);

      String[] mappings = new String[]{"org/hibernate/test/cache/infinispan/functional/Item.hbm.xml"};
      for (String mapping : mappings) {
         cfg.addResource(mapping, Thread.currentThread().getContextClassLoader());
      }
      cfg.buildMappings();
      Iterator iter = cfg.getClassMappings();
      while (iter.hasNext()) {
         PersistentClass clazz = (PersistentClass) iter.next();
View Full Code Here

            cfg.setProperty(Environment.PASS, password);
            cfg.setProperty(Environment.AUTOCOMMIT, autocommit ? "True" : "False");

            // example: com/osm/model/academical/Task.hbm.xml
            for (String resource : resources) {
                cfg.addResource(resource);
            }

        } catch (Throwable ex) {
            ex.printStackTrace();
        }
View Full Code Here

        cfg.addAnnotatedClass(
            serviceRegistry.getService( ClassLoaderService.class ).classForName( jaxbMapping.getClazz() )
        );
      }
      else if ( jaxbMapping.getResource() != null ) {
        cfg.addResource( jaxbMapping.getResource() );
      }
      else if ( jaxbMapping.getJar() != null ) {
        cfg.addJar( new File( jaxbMapping.getJar() ) );
      }
      else if ( jaxbMapping.getPackage() != null ) {
View Full Code Here

      Boolean useMetaInf = null;
      try {
        if ( resourceName.endsWith( META_INF_ORM_XML ) ) {
          useMetaInf = true;
        }
        cfg.addResource( resourceName );
      }
      catch( MappingNotFoundException e ) {
        if ( ! resourceName.endsWith( META_INF_ORM_XML ) ) {
          throw persistenceException( "Unable to find XML mapping file in classpath: " + resourceName );
        }
View Full Code Here

    Configuration cfg = new Configuration().setProperties( buildProperties() );


    String[] mappingFiles = PropertiesHelper.toStringArray( mapResources, " ,\n\t\r\f" );
    for ( int i = 0; i < mappingFiles.length; i++ ) {
      cfg.addResource( mappingFiles[i] );
    }

    if ( customListeners != null && !customListeners.isEmpty() ) {
      Iterator entries = customListeners.entrySet().iterator();
      while ( entries.hasNext() ) {
View Full Code Here

        cfg.addAnnotatedClass(
            serviceRegistry.getService( ClassLoaderService.class ).classForName( jaxbMapping.getClazz() )
        );
      }
      else if ( jaxbMapping.getResource() != null ) {
        cfg.addResource( jaxbMapping.getResource() );
      }
      else if ( jaxbMapping.getJar() != null ) {
        cfg.addJar( new File( jaxbMapping.getJar() ) );
      }
      else if ( jaxbMapping.getPackage() != null ) {
View Full Code Here

      Boolean useMetaInf = null;
      try {
        if ( resourceName.endsWith( META_INF_ORM_XML ) ) {
          useMetaInf = true;
        }
        cfg.addResource( resourceName );
      }
      catch( MappingNotFoundException e ) {
        if ( ! resourceName.endsWith( META_INF_ORM_XML ) ) {
          throw persistenceException( "Unable to find XML mapping file in classpath: " + resourceName );
        }
View Full Code Here

      envProps.put(AvailableSettings.JTA_PLATFORM, new JBossStandAloneJtaPlatform());
      serviceRegistry = ServiceRegistryBuilder.buildServiceRegistry(envProps);

      String[] mappings = new String[]{"org/hibernate/test/cache/infinispan/functional/Item.hbm.xml"};
      for (String mapping : mappings) {
         cfg.addResource(mapping, Thread.currentThread().getContextClassLoader());
      }
      cfg.buildMappings();
      Iterator iter = cfg.getClassMappings();
      while (iter.hasNext()) {
         PersistentClass clazz = (PersistentClass) iter.next();
View Full Code Here

      this.resource = resource;
    }
    public void apply(Object target, WireContext wireContext) {
      ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
      Configuration configuration = (Configuration) target;
      configuration.addResource(resource, classLoader);
    }
    public String toString() {
      return "adding mapping resource "+resource+" to hibernate configuration";
    }
  }
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.