Package org.hibernate.cfg

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


    for (int i = 0; i < getMappings().length; i++) {
      cfg.addAnnotatedClass( getMappings()[i] );
    }
    cfg.setProperty( "hibernate.search.default.directory_provider", RAMDirectoryProvider.class.getName() );
    try {
      cfg.buildSessionFactory( /*new TestInterceptor()*/ );
      fail("Undefined bridge went through");
    }
    catch( SearchException e ) {
      //success
    }
View Full Code Here


        for (HibernateConfigurer configurer : hibernateConfigurers)
            configurer.configure(configuration);

        long configurationComplete = System.currentTimeMillis();

        _sessionFactory = configuration.buildSessionFactory();
        _configuration = new ImmutableConfiguration(configuration);

        long factoryCreated = System.currentTimeMillis();

        logger.info(HibernateMessages.startupTiming(
View Full Code Here

   */
  @Before
  public void setUp() throws Exception {
    AnnotationConfiguration cfg = new AnnotationConfiguration();
    cfg.configure().setProperty("hibernate.connection.url", "jdbc:hsqldb:mem:mydvdsDB");
    session = cfg.buildSessionFactory().openSession();
    session.beginTransaction();
    dao = new DefaultDvdDao(session);
  }


View Full Code Here

   */
  @Before
  public void setUp() throws Exception {
    AnnotationConfiguration cfg = new AnnotationConfiguration();
    cfg.configure().setProperty("hibernate.connection.url", "jdbc:hsqldb:mem:mydvdsDB");
    session = cfg.buildSessionFactory().openSession();
    session.beginTransaction();
    dao = new DefaultUserDao(session);
  }


View Full Code Here

         }
      }
     
      configuration.setInterceptor(new HibernateSecurityInterceptor(configuration.getInterceptor()));
     
      return configuration.buildSessionFactory();
   }
  
   public String getCfgResourceName()
   {
      return cfgResourceName;
View Full Code Here

    for (int i = 0; i < getMappings().length; i++) {
      cfg.addAnnotatedClass( getMappings()[i] );
    }
    cfg.setProperty( "hibernate.search.default.directory_provider", RAMDirectoryProvider.class.getName() );
    try {
      cfg.buildSessionFactory();
      fail("Undefined bridge went through");
    }
    catch( Exception e ) {
      Throwable ee = e;
      boolean hasSearchException = false;
View Full Code Here

                }
            }
        });

        try {
            final SessionFactory sessionFactory = cfg.buildSessionFactory();
            logger.info("finished building hibernate session factory ... ");

            Provider<Session> sessionProvider = new Provider<Session>() {
                public Session get() {
                    return sessionFactory.openSession();
View Full Code Here

  public void testGeneratedSql() {
    try {
      AnnotationConfiguration config = new AnnotationConfiguration();
      config.addAnnotatedClass(Address.class);
      config.addAnnotatedClass(Person.class);
      config.buildSessionFactory();
      String[] schema = config
          .generateSchemaCreationScript(new SQLServerDialect());
      for (String s : schema) {
        log.debug(s);
      }
View Full Code Here

    try {
      AnnotationConfiguration config = new AnnotationConfiguration();
      config.addAnnotatedClass(Bunny.class);
      config.addAnnotatedClass(PointyTooth.class);
      config.addAnnotatedClass(TwinkleToes.class);
      config.buildSessionFactory();
      String[] schema = config
          .generateSchemaCreationScript(new SQLServerDialect());
      for (String s : schema) {
        log.debug(s);
      }
View Full Code Here

  public void testDeclarativeMix() throws Exception {
    AnnotationConfiguration cfg = new AnnotationConfiguration();
    cfg.addAnnotatedClass( IncorrectEntity.class );
    cfg.setProperty( Environment.HBM2DDL_AUTO, "create-drop" );
    try {
      SessionFactory sf = cfg.buildSessionFactory();
      fail( "Entity wo id should fail" );
    }
    catch (AnnotationException e) {
      //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.