Package org.hibernate.cfg

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


    AnnotationConfiguration cfg = new AnnotationConfiguration();
    cfg.setProperty( Environment.HBM2DDL_AUTO, "create-drop" );
    try {
      cfg.addAnnotatedClass( Flight.class );
      cfg.addAnnotatedClass( org.hibernate.test.annotations.Flight.class );
      cfg.addResource( "org/hibernate/test/annotations/orm.xml" );
      cfg.addResource( "org/hibernate/test/annotations/duplicatedgenerator/orm.xml" );
      cfg.buildSessionFactory();
      fail( "Should not be able to map the same entity name twice" );
    }
    catch (AnnotationException ae) {
View Full Code Here


    cfg.setProperty( Environment.HBM2DDL_AUTO, "create-drop" );
    try {
      cfg.addAnnotatedClass( Flight.class );
      cfg.addAnnotatedClass( org.hibernate.test.annotations.Flight.class );
      cfg.addResource( "org/hibernate/test/annotations/orm.xml" );
      cfg.addResource( "org/hibernate/test/annotations/duplicatedgenerator/orm.xml" );
      cfg.buildSessionFactory();
      fail( "Should not be able to map the same entity name twice" );
    }
    catch (AnnotationException ae) {
      //success
View Full Code Here

      }
      if (mappingResources!= null)
      {
         for (String resourceName : mappingResources)
         {
            configuration.addResource(resourceName);
         }
      }
     
      configuration.setInterceptor(new HibernateSecurityInterceptor(configuration.getInterceptor()));
     
View Full Code Here

*/
public class ConfigurationTest extends TestCase {
  public void testMixPackageAndResourceOrdering() throws Exception {
    try {
      AnnotationConfiguration config = new AnnotationConfiguration();
      config.addResource( "org/hibernate/test/annotations/configuration/orm.xml" );
      config.addPackage( "org.hibernate.test.annotations.configuration" );
    }
    catch( Exception e ) {
      fail("Processing package first when ORM.xml is used should not fail");
    }
View Full Code Here

    AnnotationConfiguration cfg = new AnnotationConfiguration();
    cfg.setProperty( Environment.HBM2DDL_AUTO, "create-drop" );
    try {
      cfg.addAnnotatedClass( Flight.class );
      cfg.addAnnotatedClass( org.hibernate.test.annotations.Flight.class );
      cfg.addResource( "org/hibernate/test/annotations/orm.xml");
      cfg.addResource( "org/hibernate/test/annotations/duplicatedgenerator/orm.xml");
      cfg.buildSessionFactory();
      fail( "Should not be able to map the same entity name twice" );
    }
    catch (AnnotationException ae) {
View Full Code Here

    cfg.setProperty( Environment.HBM2DDL_AUTO, "create-drop" );
    try {
      cfg.addAnnotatedClass( Flight.class );
      cfg.addAnnotatedClass( org.hibernate.test.annotations.Flight.class );
      cfg.addResource( "org/hibernate/test/annotations/orm.xml");
      cfg.addResource( "org/hibernate/test/annotations/duplicatedgenerator/orm.xml");
      cfg.buildSessionFactory();
      fail( "Should not be able to map the same entity name twice" );
    }
    catch (AnnotationException ae) {
      //success
View Full Code Here

      }
      if (mappingResources!= null)
      {
         for (String resourceName : mappingResources)
         {
            configuration.addResource(resourceName);
         }
      }
     
      configuration.setInterceptor(new HibernateSecurityInterceptor(configuration.getInterceptor()));
     
View Full Code Here

*/
public class ConfigurationTest extends TestCase {
  public void testMixPackageAndResourceOrdering() throws Exception {
    try {
      AnnotationConfiguration config = new AnnotationConfiguration();
      config.addResource( "org/hibernate/test/annotations/configuration/orm.xml" );
      config.addPackage( "org.hibernate.test.annotations.configuration" );
    }
    catch( Exception e ) {
      fail("Processing package first when ORM.xml is used should not fail");
    }
View Full Code Here

    AnnotationConfiguration cfg = new AnnotationConfiguration();
    cfg.setProperty( Environment.HBM2DDL_AUTO, "create-drop" );
    try {
      cfg.addAnnotatedClass( Flight.class );
      cfg.addAnnotatedClass( org.hibernate.test.annotations.Flight.class );
      cfg.addResource( "org/hibernate/test/annotations/orm.xml");
      cfg.addResource( "org/hibernate/test/annotations/duplicatedgenerator/orm.xml");
      cfg.buildSessionFactory();
      fail( "Should not be able to map the same entity name twice" );
    }
    catch (AnnotationException ae) {
View Full Code Here

    cfg.setProperty( Environment.HBM2DDL_AUTO, "create-drop" );
    try {
      cfg.addAnnotatedClass( Flight.class );
      cfg.addAnnotatedClass( org.hibernate.test.annotations.Flight.class );
      cfg.addResource( "org/hibernate/test/annotations/orm.xml");
      cfg.addResource( "org/hibernate/test/annotations/duplicatedgenerator/orm.xml");
      cfg.buildSessionFactory();
      fail( "Should not be able to map the same entity name twice" );
    }
    catch (AnnotationException ae) {
      //success
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.