Package org.hibernate.cfg

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


      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" );
      assertNull(
          "cannot be in the configuration yet!",
          cfg.getClassMapping( "org.hibernate.test.extendshbm.Employee" )
      );
      cfg.addResource( getBaseForMappings() + "extendshbm/Person.hbm.xml" );
View Full Code Here


      cfg.addResource( getBaseForMappings() + "extendshbm/Employee.hbm.xml" );
      assertNull(
          "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" ) );
View Full Code Here

  public void testMissingSuper() {
    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

      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" );

      cfg.buildSessionFactory();

      fail( "Should not be able to build sessionfactory without a Person" );
    }
View Full Code Here

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

    try {
      cfg.addResource( getBaseForMappings() + "extendshbm/allseparateinone.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 testJoinedSubclassAndEntityNamesOnly() {
    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 testEntityNamesWithPackageFailureExpected() {
    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

  public void testUnionSubclass() {
    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

  public void testSimpleColumnAddition() {
    String resource1 = "org/hibernate/test/schemaupdate/1_Version.hbm.xml";
    String resource2 = "org/hibernate/test/schemaupdate/2_Version.hbm.xml";

    Configuration v1cfg = new Configuration();
    v1cfg.addResource( resource1 );
    new SchemaExport( v1cfg ).execute( false, true, true, false );

    SchemaUpdate v1schemaUpdate = new SchemaUpdate( v1cfg );
    v1schemaUpdate.execute( true, true );
View Full Code Here

    v1schemaUpdate.execute( true, true );

    assertEquals( 0, v1schemaUpdate.getExceptions().size() );

    Configuration v2cfg = new Configuration();
    v2cfg.addResource( resource2 );

    SchemaUpdate v2schemaUpdate = new SchemaUpdate( v2cfg );
    v2schemaUpdate.execute( true, true );
    assertEquals( 0, v2schemaUpdate.getExceptions().size() );
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.