Package org.hibernate.cfg

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


      Iterator<Table> iter = configuration.getTableMappings();
     
      //if no session-factory is build, the configuration is not fully initialized.
      //Hence, the ForeignKey's won't have a referenced table. This is calculated on
      //second pass.
      configuration.buildMappings();
     
     
      while (iter.hasNext()) {
        Table table = (Table) iter.next();
        if (table.isPhysicalTable()) {
View Full Code Here


  public void testAllInOne() {
    Configuration cfg = new Configuration();

    cfg.addResource( getBaseForMappings() + "extendshbm/allinone.hbm.xml" );
    cfg.buildMappings();
    assertNotNull( cfg.getClassMapping( "org.hibernate.test.extendshbm.Customer" ) );
    assertNotNull( cfg.getClassMapping( "org.hibernate.test.extendshbm.Person" ) );
    assertNotNull( cfg.getClassMapping( "org.hibernate.test.extendshbm.Employee" ) );
  }
View Full Code Here

          "cannot be in the configuration yet!",
          cfg.getClassMapping( "org.hibernate.test.extendshbm.Employee" )
      );
      cfg.addResource( getBaseForMappings() + "extendshbm/Person.hbm.xml" );

      cfg.buildMappings();

      assertNotNull( cfg.getClassMapping( "org.hibernate.test.extendshbm.Person" ) );
      assertNotNull( cfg.getClassMapping( "org.hibernate.test.extendshbm.Employee" ) );
      assertNotNull( cfg.getClassMapping( "org.hibernate.test.extendshbm.Customer" ) );
View Full Code Here

    Configuration cfg = new Configuration();

    try {
      cfg.addResource( getBaseForMappings() + "extendshbm/entitynames.hbm.xml" );

      cfg.buildMappings();

      assertNotNull( cfg.getClassMapping( "EntityHasName" ) );
      assertNotNull( cfg.getClassMapping( "EntityCompany" ) );

    }
View Full Code Here

  public void testEntityNamesWithPackage() {
    Configuration cfg = new Configuration();
    try {
      cfg.addResource( getBaseForMappings() + "extendshbm/packageentitynames.hbm.xml" );

      cfg.buildMappings();

      assertNotNull( cfg.getClassMapping( "EntityHasName" ) );
      assertNotNull( cfg.getClassMapping( "EntityCompany" ) );

    }
View Full Code Here

    Configuration cfg = new Configuration();

    try {
      cfg.addResource( getBaseForMappings() + "extendshbm/unionsubclass.hbm.xml" );

      cfg.buildMappings();

      assertNotNull( cfg.getClassMapping( "org.hibernate.test.extendshbm.Person" ) );
      assertNotNull( cfg.getClassMapping( "org.hibernate.test.extendshbm.Customer" ) );

    }
View Full Code Here

    //    <!ENTITY child SYSTEM "classpath://org/hibernate/test/util/dtd/child.xml">
    // which we are expecting the Hibernate custom entity resolver to be able to resolve
    // locally via classpath lookup.
    Configuration cfg = new Configuration();
    cfg.addResource( "org/hibernate/test/util/dtd/Parent.hbm.xml" );
    cfg.buildMappings();
  }
}
View Full Code Here

  public void testDuplicateMapping() {
    String resourceName = "org/hibernate/test/mappingexception/User.hbm.xml";
    Configuration cfg = new Configuration();
    cfg.addResource( resourceName );
    cfg.buildMappings();
    try {
      cfg.addResource( resourceName );
      cfg.buildMappings();
      fail();
    }
View Full Code Here

    Configuration cfg = new Configuration();
    cfg.addResource( resourceName );
    cfg.buildMappings();
    try {
      cfg.addResource( resourceName );
      cfg.buildMappings();
      fail();
    }
    catch ( InvalidMappingException inv ) {
      assertEquals( inv.getType(), "resource" );
      assertEquals( inv.getPath(), resourceName );
View Full Code Here

      cfg.setProperty(Environment.CACHE_REGION_FACTORY, "org.hibernate.cache.infinispan.InfinispanRegionFactory");
      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();
         cfg.setCacheConcurrencyStrategy(clazz.getEntityName(), "transactional");
      }
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.