Package org.hibernate.cfg

Examples of org.hibernate.cfg.AnnotationConfiguration$ExtendedMappingsImpl


 
  @Override
  protected void setUp() throws Exception {
    super.setUp();
    injector = Guice.createInjector(new HibernateModule());   
    AnnotationConfiguration cfg = injector.getInstance(HibernateUtil.class).getConfiguration();   
    new SchemaExport(cfg).drop(false, true);
    new SchemaExport(cfg).create(false, true);
    fields = injector.getInstance(FieldFactory.class);
    models = injector.getInstance(ModelFactory.class);
    managers = injector.getInstance(Managers.class);
View Full Code Here


  private boolean isConfigurationProcessed = false;


  public Ejb3Configuration() {
    settingsFactory = new InjectionSettingsFactory();
    cfg = new AnnotationConfiguration( settingsFactory );
    cfg.setEntityNotFoundDelegate( ejb3EntityNotFoundDelegate );
    listenerConfigurator = new EventListenerConfigurator( this );
  }
View Full Code Here

/**
* @author Emmanuel Bernard
*/
public class UnresolvedBridgeTest extends TestCase {
  public void testSerializableType() throws Exception {
    AnnotationConfiguration cfg = new AnnotationConfiguration();

    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

  protected void buildSessionFactory(Class[] classes, String[] packages, String[] xmlFiles) throws Exception {
    if ( getSessions() != null ) {
      getSessions().close();
    }
    try {
      setCfg( new AnnotationConfiguration() );
      configure( cfg );
      if ( recreateSchema() ) {
        cfg.setProperty( org.hibernate.cfg.Environment.HBM2DDL_AUTO, "create-drop" );
      }
      for ( String aPackage : packages ) {
View Full Code Here

  protected void buildSessionFactory(Class[] classes, String[] packages, String[] xmlFiles) throws Exception {

    if ( getSessions() != null ) getSessions().close();
    try {
      setCfg( new AnnotationConfiguration() );
      configure( cfg );
      if ( recreateSchema() ) {
        cfg.setProperty( Environment.HBM2DDL_AUTO, "create-drop" );
      }
      for ( int i = 0; i < packages.length ; i++ ) {
View Full Code Here

  protected void buildSessionFactory(Class[] classes, String[] packages, String[] xmlFiles) throws Exception {

    if ( getSessions() != null ) getSessions().close();
    try {
      setCfg( new AnnotationConfiguration() );
      configure( cfg );
      if ( recreateSchema() ) {
        cfg.setProperty( Environment.HBM2DDL_AUTO, "create-drop" );
      }
      for ( int i = 0; i < packages.length ; i++ ) {
View Full Code Here

  private boolean isConfigurationProcessed = false;


  public Ejb3Configuration() {
    settingsFactory = new InjectionSettingsFactory();
    cfg = new AnnotationConfiguration( settingsFactory );
    cfg.setEntityNotFoundDelegate( ejb3EntityNotFoundDelegate );
    listenerConfigurator = new EventListenerConfigurator( this );
  }
View Full Code Here

      }
   }

   protected SessionFactory createSessionFactory() throws ClassNotFoundException
   {
      AnnotationConfiguration configuration = new AnnotationConfiguration();
     
      // setup non-default naming strategy
      if (namingStrategy != null)
      {
         configuration.setNamingStrategy(namingStrategy);
      }
     
      // Programmatic configuration
      if (cfgProperties != null)
      {
         Properties props = new Properties();
         props.putAll(cfgProperties);
         configuration.setProperties(props);
      }
      Hashtable<String, String> jndiProperties = Naming.getInitialContextProperties();
      if ( jndiProperties!=null )
      {
         // Prefix regular JNDI properties for Hibernate
         for (Map.Entry<String, String> entry : jndiProperties.entrySet())
         {
            configuration.setProperty( Environment.JNDI_PREFIX + "." + entry.getKey(), entry.getValue() );
         }
      }
      // hibernate.cfg.xml configuration
      if (cfgProperties==null && cfgResourceName==null)
      {
         configuration.configure();
      }
      else if (cfgProperties==null && cfgResourceName!=null)
      {
         configuration.configure(cfgResourceName);
      }
      // Mapping metadata
      if (mappingClasses!=null)
      {
         for (String className: mappingClasses)
         {
            configuration.addAnnotatedClass(ReflectHelper.classForName(className));
         }
      }
      if (mappingFiles!=null)
      {
         for (String fileName: mappingFiles)
         {
            configuration.addFile(fileName);
         }
      }
      if (mappingJars!=null)
      {
         for (String jarName: mappingJars)
         {
            configuration.addJar(new File(jarName));
         }
      }
      if (mappingPackages!= null)
      {
         for (String packageName: mappingPackages)
         {
            configuration.addPackage(packageName);
         }
      }
      if (mappingResources!= null)
      {
         for (String resourceName : mappingResources)
         {
            configuration.addResource(resourceName);
         }
      }
     
      configuration.setInterceptor(new HibernateSecurityInterceptor(configuration.getInterceptor()));
     
      return configuration.buildSessionFactory();
   }
View Full Code Here

  private boolean isConfigurationProcessed = false;


  public Ejb3Configuration() {
    settingsFactory = new InjectionSettingsFactory();
    cfg = new AnnotationConfiguration( settingsFactory );
    cfg.setEntityNotFoundDelegate( ejb3EntityNotFoundDelegate );
    listenerConfigurator = new EventListenerConfigurator( this );
  }
View Full Code Here

    public HibernateSessionSourceImpl(Logger logger, List<HibernateConfigurer> hibernateConfigurers)
    {
        long startTime = System.currentTimeMillis();

        AnnotationConfiguration configuration = new AnnotationConfiguration();

        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

TOP

Related Classes of org.hibernate.cfg.AnnotationConfiguration$ExtendedMappingsImpl

Copyright © 2018 www.massapicom. 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.