Package org.hibernate.cfg

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


    );
  }

  public void testExplicitPropertyAccessAnnotationsOnField() throws Exception {
    AnnotationConfiguration cfg = new AnnotationConfiguration();
    cfg.addAnnotatedClass( Course4.class );
    cfg.addAnnotatedClass( Student.class );
    try {
      cfg.buildSessionFactory();
      fail( "@Id and @OneToMany are not placed consistently in test entities. SessionFactory creation should fail." );
    }
View Full Code Here


  }

  public void testExplicitPropertyAccessAnnotationsOnField() throws Exception {
    AnnotationConfiguration cfg = new AnnotationConfiguration();
    cfg.addAnnotatedClass( Course4.class );
    cfg.addAnnotatedClass( Student.class );
    try {
      cfg.buildSessionFactory();
      fail( "@Id and @OneToMany are not placed consistently in test entities. SessionFactory creation should fail." );
    }
    catch ( MappingException e ) {
View Full Code Here

  }

  public void testExplicitPropertyAccessAnnotationsWithHibernateStyleOverride() throws Exception {
    AnnotationConfiguration cfg = new AnnotationConfiguration();
    Class<?> classUnderTest = Course3.class;
    cfg.addAnnotatedClass( classUnderTest );
    cfg.addAnnotatedClass( Student.class );
    SessionFactoryImplementor factory = ( SessionFactoryImplementor ) cfg.buildSessionFactory();
    EntityMetamodel metaModel = factory.getEntityPersister( classUnderTest.getName() )
        .getEntityMetamodel();
    PojoEntityTuplizer tuplizer = ( PojoEntityTuplizer ) metaModel.getTuplizer( EntityMode.POJO );
View Full Code Here

  public void testExplicitPropertyAccessAnnotationsWithHibernateStyleOverride() throws Exception {
    AnnotationConfiguration cfg = new AnnotationConfiguration();
    Class<?> classUnderTest = Course3.class;
    cfg.addAnnotatedClass( classUnderTest );
    cfg.addAnnotatedClass( Student.class );
    SessionFactoryImplementor factory = ( SessionFactoryImplementor ) cfg.buildSessionFactory();
    EntityMetamodel metaModel = factory.getEntityPersister( classUnderTest.getName() )
        .getEntityMetamodel();
    PojoEntityTuplizer tuplizer = ( PojoEntityTuplizer ) metaModel.getTuplizer( EntityMode.POJO );
    assertTrue(
View Full Code Here

  }

  public void testExplicitPropertyAccessAnnotationsWithJpaStyleOverride() throws Exception {
    AnnotationConfiguration cfg = new AnnotationConfiguration();
    Class<?> classUnderTest = Course5.class;
    cfg.addAnnotatedClass( classUnderTest );
    cfg.addAnnotatedClass( Student.class );
    SessionFactoryImplementor factory = ( SessionFactoryImplementor ) cfg.buildSessionFactory();
    EntityMetamodel metaModel = factory.getEntityPersister( classUnderTest.getName() )
        .getEntityMetamodel();
    PojoEntityTuplizer tuplizer = ( PojoEntityTuplizer ) metaModel.getTuplizer( EntityMode.POJO );
View Full Code Here

  public void testExplicitPropertyAccessAnnotationsWithJpaStyleOverride() throws Exception {
    AnnotationConfiguration cfg = new AnnotationConfiguration();
    Class<?> classUnderTest = Course5.class;
    cfg.addAnnotatedClass( classUnderTest );
    cfg.addAnnotatedClass( Student.class );
    SessionFactoryImplementor factory = ( SessionFactoryImplementor ) cfg.buildSessionFactory();
    EntityMetamodel metaModel = factory.getEntityPersister( classUnderTest.getName() )
        .getEntityMetamodel();
    PojoEntityTuplizer tuplizer = ( PojoEntityTuplizer ) metaModel.getTuplizer( EntityMode.POJO );
    assertTrue(
View Full Code Here

  }

  public void testDefaultFieldAccessIsInherited() throws Exception {
    AnnotationConfiguration cfg = new AnnotationConfiguration();
    Class<?> classUnderTest = User.class;
    cfg.addAnnotatedClass( classUnderTest );
    cfg.addAnnotatedClass( Person.class );
    cfg.addAnnotatedClass( Being.class );
    SessionFactoryImplementor factory = ( SessionFactoryImplementor ) cfg.buildSessionFactory();
    EntityMetamodel metaModel = factory.getEntityPersister( classUnderTest.getName() )
        .getEntityMetamodel();
View Full Code Here

  public void testDefaultFieldAccessIsInherited() throws Exception {
    AnnotationConfiguration cfg = new AnnotationConfiguration();
    Class<?> classUnderTest = User.class;
    cfg.addAnnotatedClass( classUnderTest );
    cfg.addAnnotatedClass( Person.class );
    cfg.addAnnotatedClass( Being.class );
    SessionFactoryImplementor factory = ( SessionFactoryImplementor ) cfg.buildSessionFactory();
    EntityMetamodel metaModel = factory.getEntityPersister( classUnderTest.getName() )
        .getEntityMetamodel();
    PojoEntityTuplizer tuplizer = ( PojoEntityTuplizer ) metaModel.getTuplizer( EntityMode.POJO );
View Full Code Here

  public void testDefaultFieldAccessIsInherited() throws Exception {
    AnnotationConfiguration cfg = new AnnotationConfiguration();
    Class<?> classUnderTest = User.class;
    cfg.addAnnotatedClass( classUnderTest );
    cfg.addAnnotatedClass( Person.class );
    cfg.addAnnotatedClass( Being.class );
    SessionFactoryImplementor factory = ( SessionFactoryImplementor ) cfg.buildSessionFactory();
    EntityMetamodel metaModel = factory.getEntityPersister( classUnderTest.getName() )
        .getEntityMetamodel();
    PojoEntityTuplizer tuplizer = ( PojoEntityTuplizer ) metaModel.getTuplizer( EntityMode.POJO );
    assertTrue(
View Full Code Here

    );
  }

  public void testDefaultPropertyAccessIsInherited() throws Exception {
    AnnotationConfiguration cfg = new AnnotationConfiguration();
    cfg.addAnnotatedClass( Horse.class );
    cfg.addAnnotatedClass( Animal.class );

    SessionFactoryImplementor factory = ( SessionFactoryImplementor ) cfg.buildSessionFactory();
    EntityMetamodel metaModel = factory.getEntityPersister( Animal.class.getName() )
        .getEntityMetamodel();
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.