Package org.hibernate.cfg

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


    config = new AnnotationConfiguration();
    config.addAnnotatedClass( Customer5.class );
    config.addAnnotatedClass( Order.class );
    config.addAnnotatedClass( Country.class );
    try {
      config.buildSessionFactory();
      fail();
    }
    catch ( MappingException e ) {
      log.trace( "success" );
    }
View Full Code Here


    config.addAnnotatedClass( Customer.class );
    config.addAnnotatedClass( Order.class );
    config.addAnnotatedClass( SupportTickets.class );
    config.addAnnotatedClass( Country.class );
    config.addPackage( Customer.class.getPackage().getName() );
    SessionFactoryImplementor sessionImpl = ( SessionFactoryImplementor ) config.buildSessionFactory();

    assertTrue(
        "fetch profile not parsed properly",
        sessionImpl.containsFetchProfileDefinition( "package-profile-1" )
    );
View Full Code Here

            }
        }

        long configurationComplete = System.currentTimeMillis();

        _sessionFactory = configuration.buildSessionFactory();

        long factoryCreated = System.currentTimeMillis();

        log.info(HibernateMessages.startupTiming(configurationComplete - startTime, factoryCreated
                - startTime));
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

    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

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

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

        long configurationComplete = System.currentTimeMillis();

        _sessionFactory = configuration.buildSessionFactory();

        long factoryCreated = System.currentTimeMillis();

        logger.info(HibernateMessages.startupTiming(
                configurationComplete - startTime,
View Full Code Here

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

        long configurationComplete = System.currentTimeMillis();

        sessionFactory = configuration.buildSessionFactory();
        this.configuration = new ImmutableConfiguration(configuration);

        long factoryCreated = System.currentTimeMillis();

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

        AnnotationConfiguration configuration = new AnnotationConfiguration();
        configuration.addAnnotatedClass( getUcl().loadClass( "Project" ) );
        configuration.addAnnotatedClass( getUcl().loadClass( "Employee" ) );
          configuration.addAnnotatedClass( getUcl().loadClass( "WorksOnContext" ) );

        SessionFactory sf = configuration.buildSessionFactory();
        Session s = sf.openSession();
        Query createQuery = s.createQuery("from java.lang.Object");
        createQuery.list();
        s.close();
        sf.close();
View Full Code Here

    Class transportationPk = ucl.loadClass( "org.hibernate.tool.hbm2x.TransportationPk" );
    configuration.addAnnotatedClass( train );
    configuration.addAnnotatedClass( passenger );

    configuration.setProperty( "hibernate.hbm2ddl.auto", "create-drop" );
    SessionFactory sf = configuration.buildSessionFactory();
    Session s = sf.openSession();

    Object trainId = transportationPk.newInstance();
    transportationPk.getMethod( "setCity", new Class[]{String.class} ).invoke( trainId, new Object[]{"Paris"} );
    transportationPk.getMethod( "setLine", new Class[]{String.class} ).invoke( trainId, new Object[]{"Ligne 1"} );
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.