[CONJ-537] MariaDB jdbc driver does not play well with hbm2java Created: 2017-10-09  Updated: 2017-10-10  Resolved: 2017-10-10

Status: Closed
Project: MariaDB Connector/J
Component/s: Other
Affects Version/s: None
Fix Version/s: 1.4.5

Type: Bug Priority: Major
Reporter: Florin Jurcovici Assignee: Diego Dupin
Resolution: Duplicate Votes: 0
Labels: None
Environment:

I think the relevant parts are these:

<dependency>
<groupId>org.mariadb.jdbc</groupId>
<artifactId>mariadb-java-client</artifactId>
<version>1.1.7</version>
</dependency>

And the following hibernate-related dependencies:

<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
<version>4.3.11.Final</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-entitymanager</artifactId>
<version>4.3.11.Final</version>
</dependency>
<dependency>
<groupId>org.hibernate.common</groupId>
<artifactId>hibernate-commons-annotations</artifactId>
<version>4.0.5.Final</version>
</dependency>
<dependency>
<groupId>org.hibernate.javax.persistence</groupId>
<artifactId>hibernate-jpa-2.1-api</artifactId>
<version>1.0.0.Final</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-tools</artifactId>
<version>4.3.2.Final</version>
<exclusions>
<exclusion>
<groupId>*</groupId>
<artifactId>*</artifactId>
</exclusion>
</exclusions>
</dependency>



 Description   

Original description, which allowed me to make progress, here: https://mariadb.com/kb/en/library/hibernate-reverse-engineering-wizard-with-mariadb/#comment_1389

Essentially, the failure is caused by the mariadb driver reporting types of regular tables as "BASE TABLE" in combination with the following code in hibernate tools:

if ( ("TABLE".equalsIgnoreCase(tableType) || "VIEW".equalsIgnoreCase(tableType) /*|| "SYNONYM".equals(tableType) */) ) { //||
...
} else {
  log.debug("Ignoring table " + tableName + " of type " + tableType);
}

I'm reporting it here since the root cause is a backwards compatibility issue of mariadb, as far as I can tell, although it would probably be best solved in hibernate tools. Maybe the simplest fix for mariadb would be to submit a pull request to the hibernate tools maintainers



 Comments   
Comment by Diego Dupin [ 2017-10-09 ]

This has been corrected with CONJ-218.

The version used (1.1.7) doesn't have this correction. try recent one like 1.6.5 for java < 8, or 2.1.2 for java 8+.

Comment by Florin Jurcovici [ 2017-10-10 ]

Thanks. Changed dependency and verified, it does indeed work. This ticket can be closed, IMO.

Generated at Thu Feb 08 03:16:24 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.