This is a read-only copy of the MariaDB Knowledgebase generated on 2024-11-16. For the latest, interactive version please visit https://mariadb.com/kb/.

Hibernate Reverse Engineering wizard with MariaDB

(Sorry, couldn't find a good place for this query - perhaps there ought to be a folder "MariaDB and ORMs"?)

I'm trying to use the Hibernate Reverse Engineering wizard with MariaDB. It's just a very simple example, but I am stuck. I don't see any errors, but it doesn't work as described.

Here's what I've got so far:

  • Windows 7 x64, Eclipse Juno, MariaDB v5.5.3, Hibernate v4.2.3
  • I've got an example with Hibernate running using annotations and the same instance of MariaDB, no problem
  • Now I want to create the classes from the tables, so I'm trying to use the reverse engineering wizard.
  • I've set up a simple DB and a couple of tables
  • I've set up a hibernate.cfg.xml file using the same values as my working annotation example
  • Now I use the wizard (in Eclipse) to "New/Hibernate Reverse Engineering File (reveng.xml)"
    • First page ok, second page "Configure Table filters" is where I'm stuck
    • I select the correct Console configuration (generated as part of creating the config file) and then press the "Refresh" button
    • At this point I should see my two tables in the "Database schema:" column. But it's empty.
    • I briefly see "Pending..." - then nothing.
    • I can't see any errors.

So, how to move forwards? Can I turn on some logging? Where is the error? What logs to check?

The Eclipse console window shows a bunch of stuff, all info, no errors and the last three lines are like this:

  • 2013-08-22 11:34:38,189 DEBUG Worker-33 org.hibernate.connection.DriverManagerConnectionProvider - opening new JDBC connection
  • 2013-08-22 11:34:38,198 DEBUG Worker-33 org.hibernate.connection.DriverManagerConnectionProvider - created connection to: jdbc:mysql:localhost:3306/omthibernate, Isolation Level: 4
  • 2013-08-22 11:34:38,199 INFO Worker-33 org.hibernate.connection.DriverManagerConnectionProvider - cleaning up connection pool: jdbc:mysql:localhost:3306/omthibernate

In case it helps, here is the hibernate config (I've tried a lot of variations):

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD 3.0//EN"
                                     "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
 <session-factory name="xxx">
  <property name="hibernate.connection.driver_class">org.mariadb.jdbc.Driver</property>
  <property name="hibernate.connection.password">password</property>
  <property name="hibernate.connection.url">jdbc:mysql://localhost:3306/omthibernate</property>
  <property name="hibernate.connection.username">user</property>
  <property name="hibernate.dialect">org.hibernate.dialect.MySQL5InnoDBDialect</property>
 </session-factory>
</hibernate-configuration>

Answer Answered by Michael Widenius in this comment.

Sorry, don't know anything about Hibernate so I can't help you with that.

One thing you could do is to turn on the general log in MariaDB by starting mysqld with --general-log.

By doing this you will at least know what kind of queries the wizard is sending to MariaDB. Maybe that may help you to how to go forward.

Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.