Package org.hibernate.cfg

Examples of org.hibernate.cfg.AnnotationConfiguration$ErrorLogger


  private SessionFactory sessionFactory;
  private final ThreadLocal<SessionInfo> session = new ThreadLocal<SessionInfo>();

  public SessionFactoryHolder() {
    try {
      sessionFactory = new AnnotationConfiguration().configure().buildSessionFactory();
    } catch (Exception e) {
      throw new RuntimeException("初始化 SessionFactoryHolder 失败",e);
    }
  }
View Full Code Here


  private static final SessionFactory sessionFactory = buildSessionFactory();
  
      private static SessionFactory buildSessionFactory() {
          try {
              // Create the SessionFactory from hibernate.cfg.xml
              return new AnnotationConfiguration().configure()
                      .buildSessionFactory();
          } catch (Throwable ex) {
              System.err.println("Initial SessionFactory creation failed." + ex);
              throw new ExceptionInInitializerError(ex);
          }
View Full Code Here

        return ArrayHelper.toStringArray(files);
    }

    private Configuration getConfiguration() throws Exception {
        AnnotationConfiguration cfg = new AnnotationConfiguration();
        if (namingStrategy!=null) {
            cfg.setNamingStrategy(
                    (NamingStrategy) ReflectHelper.classForName(namingStrategy).newInstance()
                );
        }
        if (configurationFile!=null) {
            cfg.configure( configurationFile );
        }

        String[] files = getFiles();
        for (int i = 0; i < files.length; i++) {
            String filename = files[i];
            if ( filename.endsWith(".jar") ) {
                cfg.addJar( new File(filename) );
            }
            else {
                cfg.addFile(filename);
            }
        }
        return cfg;
    }
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

  private transient ClassLoader overridenClassLoader;


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

    //processes specific properties
    List<String> jaccKeys = new ArrayList<String>();


    Configuration defaultConf = new AnnotationConfiguration();
    Interceptor defaultInterceptor = defaultConf.getInterceptor();
    NamingStrategy defaultNamingStrategy = defaultConf.getNamingStrategy();

    Iterator propertyIt = preparedProperties.keySet().iterator();
    while ( propertyIt.hasNext() ) {
      Object uncastObject = propertyIt.next();
      //had to be safe
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

  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 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

TOP

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

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.