facebook

Hibernate Datasource Configuration

  1. MyEclipse Archived
  2.  > 
  3. Database Tools (DB Explorer, Hibernate, etc.)
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #269896 Reply

    jcorbin4607
    Member

    Using the Hibernate Configuration Wizard in MyEclipseIDE 5.1.1GA I created the following configuration that specifies a MySQL datasource setup.

    I believe my configuration for a datasource is correct for Hibernate. Its included below.

    When I deploy my EAR and run the application (deploy on JBOSS 4.0.4) I get the following in the log:

    08:17:00,190 INFO [TransactionManagerLookupFactory] instantiating TransactionManagerLookup: net.sf.hibernate.transaction.JBossTransactionManagerLookup
    08:17:00,198 ERROR [TransactionManagerLookupFactory] Could not instantiate TransactionManagerLookup
    java.lang.ClassNotFoundException: No ClassLoaders found for: net.sf.hibernate.transaction.JBossTransactionManagerLookup

    I’m not sure what I could be missing. I’ve copied the hibernate jars to the <server>/lib directory in my JBOSS distribution so they should be there. I wasn’t sure where the JBossTransactionManagerLookup class lives.

    <!– Generated by MyEclipse Hibernate Tools. –>
    <hibernate-configuration>

    <session-factory>
    <property name=”connection.datasource”>java:DefaultDS</property>
    <property name=”show_sql”>true</property>
    <property name=”hibernate.transaction.manager_lookup_class”>net.sf.hibernate.transaction.JBossTransactionManagerLookup</property>
    <property name=”hibernate.transaction.factory_class”>
    org.hibernate.transaction.CMTTransactionFactory
    </property>
    <property name=”hibernate.transaction.flush_before_completion”>true</property>
    <property name=”hibernate.transaction.auto_close_session”>true</property>
    <property name=”dialect”>
    org.hibernate.dialect.MySQLInnoDBDialect
    </property>
    <mapping resource=”com/receptrix/hibernate/Address.hbm.xml” />
    <mapping resource=”com/receptrix/hibernate/Customer.hbm.xml” />
    </session-factory>

    </hibernate-configuration>

    #269928 Reply

    jcorbin4607
    Member

    Here is the property set I came up with that seemed to work for specifying a DataSource connection to Hibernate in MyEclipseIDE.

    Not that it is important, but the DB is MySQL 5 and the Application Server is JBOSS 4.0.4.

    Note: I did not use the wizard.

    <property name=”show_sql”>true</property>
    <property name=”hibernate.connection.provider_class”>org.hibernate.connection.DatasourceConnectionProvider</property>
    <property name=”hibernate.connection.datasource”>java:/DefaultDS</property>
    <property name=”hibernate.transaction.factory_class”>org.hibernate.transaction.JTATransactionFactory</property>
    <property name=”hibernate.transaction.manager_lookup_class”>org.hibernate.transaction.JBossTransactionManagerLookup</property>
    <property name=”hibernate.transaction.flush_before_completion”>true</property>
    <property name=”hibernate.transaction.auto_close_session”>true</property>
    <property name=”dialect”>org.hibernate.dialect.MySQLInnoDBDialect</property>

    #269958 Reply

    Riyad Kalla
    Member

    jcorbin,
    The issue was that you were specifying the old Hibernate 2.x package class using net.sf.*, Hibernate refactored to org.hibernate.* I believe either in late 2.x or early 3.x (I could be wrong). But either way you got it.

    Thanks for following up.

Viewing 3 posts - 1 through 3 (of 3 total)
Reply To: Hibernate Datasource Configuration

You must be logged in to post in the forum log in