2 Replies Latest reply on Feb 18, 2009 9:24 AM by maxandersen

    Hibernate Tools: The chosen transaction strategy requires ac

    viniciuscarvalho

      Hello there! I've already used Hibernate tools on previous projects, now I've migrate to 3.0 version. And tried to configure an hibernate configuration for my jpa project (it is not a facet on eclipse, its just a plain java project with annotations).

      Well, here's my persistence.xml

      <persistence>
       <persistence-unit name="myPU">
       <provider>org.hibernate.ejb.HibernatePersistence</provider>
       <jta-data-source>jdbc/myDS</jta-data-source>
       <properties>
       <property name="hibernate.connection.dialect" value="org.hibernate.dialect.MySQLDialect"/>
       <property name="hibernate.Log" value="DefaultLevel=WARN, Tool=INFO"/>
       <property name="hibernate.show_sql" value="false" />
       <property name="hibernate.format_sql" value="true" />
       <property name="hibernate.generate_statistics" value="true"/>
       <property name="hibernate.session_factory_name" value="java:/mySessionFactory"/>
       </properties>
       </persistence-unit>
      </persistence>
      


      and I've created an hibernate-console.properties:

      #File used by hibernate tools to override <datasource> and other container specific settings in persistence.xml
      hibernate.connection.password=root
      hibernate.connection.username=root
      hibernate.connection.driver_class=com.mysql.jdbc.Driver
      hibernate.dialect=org.hibernate.dialect.MySQLDialect
      hibernate.connection.url=jdbc:mysql://localhost:3306/mydb
      
      hibernate.connection.provider_class=org.hibernate.connection.DriverManagerConnectionProvider
      hibernate.datasource=
      hibernate.transaction.manager_lookup_class=
      


      But when I open the sessionfactory I get tho following exception:
      Error
      Wed Feb 18 07:56:38 BRT 2009
      org.hibernate.HibernateException: The chosen transaction strategy requires access to the JTA TransactionManager
      
      org.hibernate.HibernateException: The chosen transaction strategy requires access to the JTA TransactionManager
       at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:329)
       at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1294)
       at org.hibernate.cfg.AnnotationConfiguration.buildSessionFactory(AnnotationConfiguration.java:915)
       at org.hibernate.console.ConsoleConfiguration$3.execute(ConsoleConfiguration.java:399)
       at org.hibernate.console.execution.DefaultExecutionContext.execute(DefaultExecutionContext.java:64)
       at org.hibernate.console.ConsoleConfiguration.execute(ConsoleConfiguration.java:93)
       at org.hibernate.console.ConsoleConfiguration.buildSessionFactory(ConsoleConfiguration.java:394)
       at org.hibernate.eclipse.console.workbench.LazySessionFactoryAdapter.getChildren(LazySessionFactoryAdapter.java:43)
       at org.hibernate.eclipse.console.workbench.BasicWorkbenchAdapter.getChildren(BasicWorkbenchAdapter.java:99)
       at org.hibernate.eclipse.console.workbench.BasicWorkbenchAdapter.fetchDeferredChildren(BasicWorkbenchAdapter.java:105)
       at org.eclipse.ui.progress.DeferredTreeContentManager$1.run(DeferredTreeContentManager.java:234)
       at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55)
      
      


      What am I missing here?

      Regards