Error viewing tables of database with hibernate tools


#1

Hi all,

i’m totally new to Hibernate and tried out some tutorials. Basically this worked fine, except reverse engineering with the hibernate tools. I set up a new Java project and created hibernate configuration file and console configuration. When i come to the point to view the tables of my database errors are thrown.
image

Since days i’m struggling with this error and could’nt find any solution.
The connection seems to work, as the availabe schemas/catalogs are shown. But what is confusing me, is why there seems to be no configured schema/catalog. Although i tried configuring them in my config file.
Also i expected my existing databases as schemas, not as catalogs. But i don’t know if this is relevant.
I would really appreciate some help!

I’m working with:
Eclipse Neon.3 Release (4.6.3)
JBoss Tools 4.4.4.Final
MySQL 8.0.11

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD 3.0//EN"
                                         "http://www.hibernate.org/dtd/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
 <session-factory name="">
  <property name="hibernate.connection.driver_class">com.mysql.cj.jdbc.Driver</property>
  <property name="hibernate.connection.password"></property>
  <property name="hibernate.connection.url">jdbc:mysql://localhost/?useUnicode=true&amp;useJDBCCompliantTimezoneShift=true&amp;useLegacyDatetimeCode=false&amp;serverTimezone=UTC</property>
  <property name="hibernate.connection.username">root</property>
  <property name="hibernate.dialect">org.hibernate.dialect.MySQLDialect</property>
  <property name="hibernate.default_catalog">hiber</property>
 </session-factory>
</hibernate-configuration>

!ENTRY org.hibernate.eclipse.console 4 4 2018-05-07 19:12:22.007
!MESSAGE Problems while reading database schema
!SUBENTRY 1 org.hibernate.eclipse.console 4 150 2018-05-07 19:12:22.007
!MESSAGE org.jboss.tools.hibernate.runtime.spi.HibernateException: Could not get list of tables from database. Probably a JDBC driver problem. 
Configured schema:null
Configured catalog:null
Available schemas:
Available catalogs:
  hiber
  information_schema
  mysql
  performance_schema
  sys
  testscheme

!STACK 0
org.jboss.tools.hibernate.runtime.spi.HibernateException: Could not get list of tables from database. Probably a JDBC driver problem. 
Configured schema:null
Configured catalog:null
Available schemas:
Available catalogs:
  hiber
  information_schema
  mysql
  performance_schema
  sys
  testscheme

	at org.hibernate.eclipse.console.workbench.LazyDatabaseSchemaWorkbenchAdapter$2.execute(LazyDatabaseSchemaWorkbenchAdapter.java:141)
	at org.hibernate.console.execution.DefaultExecutionContext.execute(DefaultExecutionContext.java:63)
	at org.hibernate.console.ConsoleConfiguration.execute(ConsoleConfiguration.java:107)
	at org.hibernate.eclipse.console.workbench.LazyDatabaseSchemaWorkbenchAdapter.readDatabaseSchema(LazyDatabaseSchemaWorkbenchAdapter.java:124)
	at org.hibernate.eclipse.console.workbench.LazyDatabaseSchemaWorkbenchAdapter.getChildren(LazyDatabaseSchemaWorkbenchAdapter.java:64)
	at org.hibernate.eclipse.console.workbench.BasicWorkbenchAdapter.fetchDeferredChildren(BasicWorkbenchAdapter.java:104)
	at org.eclipse.ui.progress.DeferredTreeContentManager$1.run(DeferredTreeContentManager.java:231)
	at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55)
Caused by: java.sql.SQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'HAVING TABLE_TYPE IN ('TABLE','VIEW',null,null,null) ORDER BY TABLE_TYPE, TABLE_' at line 1
	at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:118)
	at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:95)
	at com.mysql.cj.jdbc.exceptions.SQLExceptionsMapping.translateException(SQLExceptionsMapping.java:122)
	at com.mysql.cj.jdbc.ClientPreparedStatement.executeInternal(ClientPreparedStatement.java:960)
	at com.mysql.cj.jdbc.ClientPreparedStatement.executeQuery(ClientPreparedStatement.java:1019)
	at com.mysql.cj.jdbc.DatabaseMetaDataUsingInfoSchema.executeMetadataQuery(DatabaseMetaDataUsingInfoSchema.java:62)
	at com.mysql.cj.jdbc.DatabaseMetaDataUsingInfoSchema.getTables(DatabaseMetaDataUsingInfoSchema.java:835)
	at org.hibernate.cfg.reveng.dialect.JDBCMetaDataDialect.getTables(JDBCMetaDataDialect.java:27)
	at org.hibernate.cfg.reveng.TableProcessor.processTables(TableProcessor.java:39)
	at org.hibernate.cfg.reveng.JDBCReader.readDatabaseSchema(JDBCReader.java:58)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
	at java.lang.reflect.Method.invoke(Unknown Source)
	at org.jboss.tools.hibernate.runtime.common.Util.invokeMethod(Util.java:43)
	at org.jboss.tools.hibernate.runtime.common.AbstractJDBCReaderFacade.readDatabaseSchema(AbstractJDBCReaderFacade.java:32)
	at org.hibernate.eclipse.console.workbench.LazyDatabaseSchemaWorkbenchAdapter$2.execute(LazyDatabaseSchemaWorkbenchAdapter.java:132)
	... 7 more
!SUBENTRY 2 org.hibernate.eclipse.console 4 150 2018-05-07 19:12:22.007
!MESSAGE org.jboss.tools.hibernate.runtime.spi.HibernateException: Could not get list of tables from database. Probably a JDBC driver problem. 
Configured schema:null
Configured catalog:null
Available schemas:
Available catalogs:
  hiber
  information_schema
  mysql
  performance_schema
  sys
  testscheme

!STACK 0
org.jboss.tools.hibernate.runtime.spi.HibernateException: Could not get list of tables from database. Probably a JDBC driver problem. 
Configured schema:null
Configured catalog:null
Available schemas:
Available catalogs:
  hiber
  information_schema
  mysql
  performance_schema
  sys
  testscheme

	at org.hibernate.eclipse.console.workbench.LazyDatabaseSchemaWorkbenchAdapter$2.execute(LazyDatabaseSchemaWorkbenchAdapter.java:141)
	at org.hibernate.console.execution.DefaultExecutionContext.execute(DefaultExecutionContext.java:63)
	at org.hibernate.console.ConsoleConfiguration.execute(ConsoleConfiguration.java:107)
	at org.hibernate.eclipse.console.workbench.LazyDatabaseSchemaWorkbenchAdapter.readDatabaseSchema(LazyDatabaseSchemaWorkbenchAdapter.java:124)
	at org.hibernate.eclipse.console.workbench.LazyDatabaseSchemaWorkbenchAdapter.getChildren(LazyDatabaseSchemaWorkbenchAdapter.java:64)
	at org.hibernate.eclipse.console.workbench.BasicWorkbenchAdapter.fetchDeferredChildren(BasicWorkbenchAdapter.java:104)
	at org.eclipse.ui.progress.DeferredTreeContentManager$1.run(DeferredTreeContentManager.java:231)
	at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55)
Caused by: java.sql.SQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'HAVING TABLE_TYPE IN ('TABLE','VIEW',null,null,null) ORDER BY TABLE_TYPE, TABLE_' at line 1
	at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:118)
	at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:95)
	at com.mysql.cj.jdbc.exceptions.SQLExceptionsMapping.translateException(SQLExceptionsMapping.java:122)
	at com.mysql.cj.jdbc.ClientPreparedStatement.executeInternal(ClientPreparedStatement.java:960)
	at com.mysql.cj.jdbc.ClientPreparedStatement.executeQuery(ClientPreparedStatement.java:1019)
	at com.mysql.cj.jdbc.DatabaseMetaDataUsingInfoSchema.executeMetadataQuery(DatabaseMetaDataUsingInfoSchema.java:62)
	at com.mysql.cj.jdbc.DatabaseMetaDataUsingInfoSchema.getTables(DatabaseMetaDataUsingInfoSchema.java:835)
	at org.hibernate.cfg.reveng.dialect.JDBCMetaDataDialect.getTables(JDBCMetaDataDialect.java:27)
	at org.hibernate.cfg.reveng.TableProcessor.processTables(TableProcessor.java:39)
	at org.hibernate.cfg.reveng.JDBCReader.readDatabaseSchema(JDBCReader.java:58)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
	at java.lang.reflect.Method.invoke(Unknown Source)
	at org.jboss.tools.hibernate.runtime.common.Util.invokeMethod(Util.java:43)
	at org.jboss.tools.hibernate.runtime.common.AbstractJDBCReaderFacade.readDatabaseSchema(AbstractJDBCReaderFacade.java:32)
	at org.hibernate.eclipse.console.workbench.LazyDatabaseSchemaWorkbenchAdapter$2.execute(LazyDatabaseSchemaWorkbenchAdapter.java:132)
	... 7 more
!SUBENTRY 2 org.hibernate.eclipse.console 4 150 2018-05-07 19:12:22.007
!MESSAGE java.sql.SQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'HAVING TABLE_TYPE IN ('TABLE','VIEW',null,null,null) ORDER BY TABLE_TYPE, TABLE_' at line 1
!STACK 0
java.sql.SQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'HAVING TABLE_TYPE IN ('TABLE','VIEW',null,null,null) ORDER BY TABLE_TYPE, TABLE_' at line 1
	at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:118)
	at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:95)
	at com.mysql.cj.jdbc.exceptions.SQLExceptionsMapping.translateException(SQLExceptionsMapping.java:122)
	at com.mysql.cj.jdbc.ClientPreparedStatement.executeInternal(ClientPreparedStatement.java:960)
	at com.mysql.cj.jdbc.ClientPreparedStatement.executeQuery(ClientPreparedStatement.java:1019)
	at com.mysql.cj.jdbc.DatabaseMetaDataUsingInfoSchema.executeMetadataQuery(DatabaseMetaDataUsingInfoSchema.java:62)
	at com.mysql.cj.jdbc.DatabaseMetaDataUsingInfoSchema.getTables(DatabaseMetaDataUsingInfoSchema.java:835)
	at org.hibernate.cfg.reveng.dialect.JDBCMetaDataDialect.getTables(JDBCMetaDataDialect.java:27)
	at org.hibernate.cfg.reveng.TableProcessor.processTables(TableProcessor.java:39)
	at org.hibernate.cfg.reveng.JDBCReader.readDatabaseSchema(JDBCReader.java:58)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
	at java.lang.reflect.Method.invoke(Unknown Source)
	at org.jboss.tools.hibernate.runtime.common.Util.invokeMethod(Util.java:43)
	at org.jboss.tools.hibernate.runtime.common.AbstractJDBCReaderFacade.readDatabaseSchema(AbstractJDBCReaderFacade.java:32)
	at org.hibernate.eclipse.console.workbench.LazyDatabaseSchemaWorkbenchAdapter$2.execute(LazyDatabaseSchemaWorkbenchAdapter.java:132)
	at org.hibernate.console.execution.DefaultExecutionContext.execute(DefaultExecutionContext.java:63)
	at org.hibernate.console.ConsoleConfiguration.execute(ConsoleConfiguration.java:107)
	at org.hibernate.eclipse.console.workbench.LazyDatabaseSchemaWorkbenchAdapter.readDatabaseSchema(LazyDatabaseSchemaWorkbenchAdapter.java:124)
	at org.hibernate.eclipse.console.workbench.LazyDatabaseSchemaWorkbenchAdapter.getChildren(LazyDatabaseSchemaWorkbenchAdapter.java:64)
	at org.hibernate.eclipse.console.workbench.BasicWorkbenchAdapter.fetchDeferredChildren(BasicWorkbenchAdapter.java:104)
	at org.eclipse.ui.progress.DeferredTreeContentManager$1.run(DeferredTreeContentManager.java:231)
	at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55)


#2

org.hibernate.dialect.MySQLDialect is really old. Try with ``org.hibernate.dialect.MySQL57Dialect` and see if it works.

Also check the version of the MySQL server and make sure it’s supported by Hibernate Tools.


#3

Thanks for your response Vlad.
I’m wondering why org.hibernate.dialect.MySQL57Dialect is not listed in the dropdown.
I just edited the configuration manually, but no changes.

Still i’m really confused about
Configured schema:null Configured catalog:null
in my stacktrace.

I had a look for some compatibility information, but could’nt find any. Maybe i try going back to Community Server 5.7.

Do you have any other hints?

Thanks in advance for your help!
Marc


#4

Tried to downgrade to MySQL Community Server 5.7.22, and finally it works!
Really frustrating to lose so much time just by picking an incompatible version.

Thanks for you help!