Uploaded image for project: 'Tools (JBoss Tools)'
  1. Tools (JBoss Tools)
  2. JBIDE-10507

Hibernate Console Configurations should try and ensure configurations does not load JTA and other remote server options

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Critical Critical
    • 3.3.0.Beta3
    • 3.3.0.M5
    • hibernate
    • None

      Both H3 and H4 will default to use JTA tx managers and load datasources if configured so - i.e. JPA/EJB3 mode enables it by default.

      In Seam 2 we generated a hibernate-console.properties file that sets a few properties to "convince" H3 to not load these things.

      The important properties are:

      hibernate.connection.provider_class=org.hibernate.connection.DriverManagerConnectionProvider
      hibernate.datasource=
      hibernate.transaction.manager_lookup_class=

      Here are my recollection of the reasons:
      hibernate.connection.provider_class needs to use DriverManager since otherwise it will load datasources.
      hibernate.datasource needs to be overwritten/set to blank to ensure it will not lookup datasources
      hiberante.transaction.manager_lookup_class needs to be overwritten/blank to ensure we don't get:

      org.hibernate.HibernateException: The chosen transaction strategy requires access to the JTA TransactionManager
      at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:401)
      at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1385)
      at org.hibernate.cfg.AnnotationConfiguration.buildSessionFactory(AnnotationConfiguration.java:954)
      at org.hibernate.console.ConsoleConfiguration$4.execute(ConsoleConfiguration.java:268)
      at org.hibernate.console.execution.DefaultExecutionContext.execute(DefaultExecutionContext.java:63)
      at org.hibernate.console.ConsoleConfiguration.execute(ConsoleConfiguration.java:107)
      at org.hibernate.console.ConsoleConfiguration.buildSessionFactory(ConsoleConfiguration.java:263)
      at org.hibernate.eclipse.console.actions.ExecuteQueryAction.execute(ExecuteQueryAction.java:79)
      at org.hibernate.eclipse.console.actions.ExecuteQueryAction.run(ExecuteQueryAction.java:55)
      at org.eclipse.jface.action.Action.runWithEvent(Action.java:498)
      at org.hibernate.eclipse.console.actions.ExecuteQueryAction.runWithEvent(ExecuteQueryAction.java:59)

      Currently we probably just handle this when the settings are set to blank, but I think it starts to make sense to set these always.

              dgeraskov Dmitry Geraskov (Inactive)
              manderse@redhat.com Max Andersen
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved: