Eclipse: connecting and configuring Hibernate

6k views Asked by At

I'm new to eclipse. I'm trying to work with Hibernate. Java ee IDE version Juno , and Hibernate Tools version 3.5.1. In Database Development of the IDE i've created a a data source, and tested the connection, and it works fine. Then I have created a Hibernate configuration file hibernate.cfg.xml Then I have created a Hibernate console configuration When i try to refresh the console configuration or when i try to create the reverse engineering file i have the error "An internal error occurred during : Fetching children of TestHiber01. plugin org.eclipse.core.jobs. All the error log is :

eclipse.buildId=M20120914-1800
java.version=1.6.0_25
java.vendor=Sun Microsystems Inc.
BootLoader constants: OS=win32, ARCH=x86, WS=win32, NL=it_IT
Framework arguments:  -product org.eclipse.epp.package.jee.product
Command-line arguments:  -os win32 -ws win32 -arch x86 -product org.eclipse.epp.package.jee.product

Error
Fri Oct 05 16:03:24 CEST 2012
An internal error occurred during: "Fetching children of TestHiber01".

java.lang.NoSuchMethodError: org.eclipse.jpt.jpa.core.JptJpaCorePlugin.getJpaProjectManager()Lorg/eclipse/jpt/jpa/core/JpaProjectManager;
    at org.jboss.tools.hibernate.jpt.core.internal.HibernateJptPlugin$1.revalidateProjects(HibernateJptPlugin.java:108)
    at org.jboss.tools.hibernate.jpt.core.internal.HibernateJptPlugin$1.configurationBuilt(HibernateJptPlugin.java:127)
    at org.hibernate.console.KnownConfigurations$1$3.notify(KnownConfigurations.java:94)
    at org.hibernate.console.KnownConfigurations$Notification.run(KnownConfigurations.java:123)
    at org.hibernate.console.KnownConfigurations.fireNotification(KnownConfigurations.java:259)
    at org.hibernate.console.KnownConfigurations.access$0(KnownConfigurations.java:253)
    at org.hibernate.console.KnownConfigurations$1.configurationBuilt(KnownConfigurations.java:92)
    at org.hibernate.console.ConsoleConfiguration.fireConfigurationBuilt(ConsoleConfiguration.java:320)
    at org.hibernate.console.ConsoleConfiguration.build(ConsoleConfiguration.java:190)
    at org.hibernate.eclipse.console.workbench.ConsoleConfigurationWorkbenchAdapter.getChildren(ConsoleCon

figurationWorkbenchAdapter.java:42)     at org.hibernate.eclipse.console.workbench.BasicWorkbenchAdapter.getChildren(BasicWorkbenchAdapter.java:100)    at org.hibernate.eclipse.console.workbench.BasicWorkbenchAdapter.fetchDeferredChildren(BasicWorkbenchAdapter.java:106)  at org.eclipse.ui.progress.DeferredTreeContentManager$1.run(DeferredTreeContentManager.java:235)    at org.eclipse.core.internal.jobs.Worker.run(Worker.java:53)

The hibernate.cfg file is:

<session-factory>
    <property name="hibernate.connection.driver_class">com.mysql.jdbc.Driver</property>
    <property name="hibernate.connection.password">XXXXX</property>
    <property name="hibernate.connection.url">jdbc:mysql://localhost:3306/mydb</property>
    <property name="hibernate.connection.username">root</property>
    <property name="hibernate.dialect">org.hibernate.dialect.MySQLDialect</property>
</session-factory>

What does it mean? Why can't connect to the database?

1

There are 1 answers

0
Karen Butzke On

Hibernate Tools 3.5.1 depends on Eclipse Indigo. You have hit a compatibility issue.

When I use the JBoss Juno update site, I see this version of Hibernate Tools available for installation: Hibernate Tools 3.6.0.Alpha1-v20120910-1507-H32. Here is the corresponding JBoss issue.