Examples of Ejb3Configuration


Examples of org.hibernate.ejb.Ejb3Configuration

/**
* @author Emmanuel Bernard <emmanuel@hibernate.org>
*/
public class IdentifierGeneratorStrategyProviderTest extends TestCase {
  public void testIdentifierGeneratorStrategyProvider() {
        Ejb3Configuration conf = new Ejb3Configuration();
        conf.setProperty(
        AvailableSettings.IDENTIFIER_GENERATOR_STRATEGY_PROVIDER,
        FunkyIdentifierGeneratorProvider.class.getName() );
        conf.addAnnotatedClass( Cable.class );
    final EntityManagerFactory entityManagerFactory = conf.buildEntityManagerFactory();
    final EntityManager entityManager = entityManagerFactory.createEntityManager();
        try {
      entityManager.persist( new Cable() );
      entityManager.flush();
            fail("FunkyException should have been thrown when the id is generated");
View Full Code Here

Examples of org.hibernate.ejb.Ejb3Configuration

* @author Emmanuel Bernard
*/
public class ProgrammaticConfTest extends junit.framework.TestCase {

  public void testProgrammaticAPI() throws Exception {
    Ejb3Configuration conf = new Ejb3Configuration();
    conf.addAnnotatedClass( Cat.class );
    conf.addAnnotatedClass( Kitten.class );
    conf.addProperties(getProperties());
    EntityManagerFactory emf = conf.buildEntityManagerFactory();
    EntityManager em = emf.createEntityManager();
    Cat cat = new Cat();
    cat.setAge( 23 );
    cat.setDateOfBirth( new Date() );
    cat.setLength( 32 );
View Full Code Here

Examples of org.hibernate.ejb.Ejb3Configuration

    em.getTransaction().rollback();
    emf.close();
  }

  public void testProgrammaticCfg() throws Exception {
    Ejb3Configuration conf = new Ejb3Configuration();
    conf.configure( "org/hibernate/ejb/test/ejb3configuration/hibernate.cfg.xml" );
    conf.addProperties(getProperties());
    EntityManagerFactory emf = conf.buildEntityManagerFactory();
    EntityManager em = emf.createEntityManager();
    Cat cat = new Cat();
    cat.setAge( 23 );
    cat.setDateOfBirth( new Date() );
    cat.setLength( 32 );
View Full Code Here

Examples of org.hibernate.ejb.Ejb3Configuration

    }

    protected void init(boolean audited, String auditStrategy) throws IOException {
        this.audited = audited;

        cfg = new Ejb3Configuration();
        if (audited) {
            initListeners();
        }

        cfg.configure("hibernate.test.cfg.xml");
View Full Code Here

Examples of org.hibernate.ejb.Ejb3Configuration

    super.tearDown();
  }

  @Override
  protected void buildConfiguration() throws Exception {
    Ejb3Configuration ejbconfig = new Ejb3Configuration();
    TestCase.cfg = ejbconfig.getHibernateConfiguration();
    if ( recreateSchema() ) {
      cfg.setProperty( Environment.HBM2DDL_AUTO, "create-drop" );
    }
    cfg.setProperty( AnnotationConfiguration.USE_NEW_ID_GENERATOR_MAPPINGS, "true" );

    for ( String mappingFile : getMappings() ) {
      cfg.addResource( mappingFile );
    }

    factory = ejbconfig.createEntityManagerFactory( getConfig() );
  }
View Full Code Here

Examples of org.hibernate.ejb.Ejb3Configuration

  public ConfigurationTest(String string) {
    super( string );
  }

  public void testSharedCacheModeNone() {
    Ejb3Configuration config = buildConfiguration( SharedCacheMode.NONE );

    PersistentClass pc = config.getClassMapping( ExplicitlyCacheableEntity.class.getName() );
    assertNull( pc.getCacheConcurrencyStrategy() );

    pc = config.getClassMapping( ExplicitlyNonCacheableEntity.class.getName() );
    assertNull( pc.getCacheConcurrencyStrategy() );

    pc = config.getClassMapping( NoCacheableAnnotationEntity.class.getName() );
    assertNull( pc.getCacheConcurrencyStrategy() );
  }
View Full Code Here

Examples of org.hibernate.ejb.Ejb3Configuration

    pc = config.getClassMapping( NoCacheableAnnotationEntity.class.getName() );
    assertNull( pc.getCacheConcurrencyStrategy() );
  }

  public void testSharedCacheModeUnspecified() {
    Ejb3Configuration config = buildConfiguration( SharedCacheMode.UNSPECIFIED );

    PersistentClass pc = config.getClassMapping( ExplicitlyCacheableEntity.class.getName() );
    assertNull( pc.getCacheConcurrencyStrategy() );

    pc = config.getClassMapping( ExplicitlyNonCacheableEntity.class.getName() );
    assertNull( pc.getCacheConcurrencyStrategy() );

    pc = config.getClassMapping( NoCacheableAnnotationEntity.class.getName() );
    assertNull( pc.getCacheConcurrencyStrategy() );
  }
View Full Code Here

Examples of org.hibernate.ejb.Ejb3Configuration

    pc = config.getClassMapping( NoCacheableAnnotationEntity.class.getName() );
    assertNull( pc.getCacheConcurrencyStrategy() );
  }

  public void testSharedCacheModeAll() {
    Ejb3Configuration config = buildConfiguration( SharedCacheMode.ALL );

    PersistentClass pc = config.getClassMapping( ExplicitlyCacheableEntity.class.getName() );
    assertNotNull( pc.getCacheConcurrencyStrategy() );

    pc = config.getClassMapping( ExplicitlyNonCacheableEntity.class.getName() );
    assertNotNull( pc.getCacheConcurrencyStrategy() );

    pc = config.getClassMapping( NoCacheableAnnotationEntity.class.getName() );
    assertNotNull( pc.getCacheConcurrencyStrategy() );
  }
View Full Code Here

Examples of org.hibernate.ejb.Ejb3Configuration

    pc = config.getClassMapping( NoCacheableAnnotationEntity.class.getName() );
    assertNotNull( pc.getCacheConcurrencyStrategy() );
  }

  public void testSharedCacheModeEnable() {
    Ejb3Configuration config = buildConfiguration( SharedCacheMode.ENABLE_SELECTIVE );

    PersistentClass pc = config.getClassMapping( ExplicitlyCacheableEntity.class.getName() );
    assertNotNull( pc.getCacheConcurrencyStrategy() );

    pc = config.getClassMapping( ExplicitlyNonCacheableEntity.class.getName() );
    assertNull( pc.getCacheConcurrencyStrategy() );

    pc = config.getClassMapping( NoCacheableAnnotationEntity.class.getName() );
    assertNull( pc.getCacheConcurrencyStrategy() );
  }
View Full Code Here

Examples of org.hibernate.ejb.Ejb3Configuration

    pc = config.getClassMapping( NoCacheableAnnotationEntity.class.getName() );
    assertNull( pc.getCacheConcurrencyStrategy() );
  }

  public void testSharedCacheModeDisable() {
    Ejb3Configuration config = buildConfiguration( SharedCacheMode.DISABLE_SELECTIVE );

    PersistentClass pc = config.getClassMapping( ExplicitlyCacheableEntity.class.getName() );
    assertNotNull( pc.getCacheConcurrencyStrategy() );

    pc = config.getClassMapping( ExplicitlyNonCacheableEntity.class.getName() );
    assertNull( pc.getCacheConcurrencyStrategy() );

    pc = config.getClassMapping( NoCacheableAnnotationEntity.class.getName() );
    assertNotNull( pc.getCacheConcurrencyStrategy() );
  }
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.