Package org.hibernate.cfg

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


  }

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

    cfg.addResource( getBaseForMappings() + "extendshbm/allinone.hbm.xml" );
    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


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

    try {
      cfg.addResource( getBaseForMappings() + "extendshbm/Customer.hbm.xml" );
      assertNull(
          "cannot be in the configuration yet!",
          cfg.getClassMapping( "org.hibernate.test.extendshbm.Customer" )
      );
      cfg.addResource( getBaseForMappings() + "extendshbm/Person.hbm.xml" );
View Full Code Here

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

      cfg.buildSessionFactory();

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

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

      cfg.buildSessionFactory();

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

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

    try {
      cfg.addResource( getBaseForMappings() + "extendshbm/Customer.hbm.xml" );
      assertNull(
          "cannot be in the configuration yet!",
          cfg.getClassMapping( "org.hibernate.test.extendshbm.Customer" )
      );
      cfg.addResource( getBaseForMappings() + "extendshbm/Employee.hbm.xml" );
View Full Code Here

      assertEquals( inv.getType(), "input stream" );
      assertEquals( inv.getPath(), null );
    }

    try {
      cfg.addResource( "nothere" );
      fail();
    }
    catch ( MappingNotFoundException inv ) {
      assertEquals( inv.getType(), "resource" );
      assertEquals( inv.getPath(), "nothere" );
View Full Code Here

      assertEquals( inv.getType(), "resource" );
      assertEquals( inv.getPath(), "nothere" );
    }

    try {
      cfg.addResource( "nothere", getClass().getClassLoader() );
      fail();
    }
    catch ( MappingNotFoundException inv ) {
      assertEquals( inv.getType(), "resource" );
      assertEquals( inv.getPath(), "nothere" );
View Full Code Here

  }

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

  public void testDuplicateMapping() {
    String resourceName = "org/hibernate/test/mappingexception/User.hbm.xml";
    Configuration cfg = new Configuration();
    cfg.addResource( resourceName );
    try {
      cfg.addResource( resourceName );
      fail();
    }
    catch ( InvalidMappingException inv ) {
      assertEquals( inv.getType(), "resource" );
      assertEquals( inv.getPath(), resourceName );
View Full Code Here

      assertEquals( inv.getPath(), null );
      assertTrue( !( inv.getCause() instanceof MappingNotFoundException ) );
    }

    try {
      cfg.addResource( resourceName );
      fail();
    }
    catch ( InvalidMappingException inv ) {
      assertEquals( inv.getType(), "resource" );
      assertEquals( inv.getPath(), resourceName );
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.