[CONJ-702] since 2.4.0 j-connector throws sequence errors via JPA/ eclipselink on @GeneratedValue(strategy = GenerationType.IDENTITY) columns Created: 2019-05-14 Updated: 2021-11-09 |
|
| Status: | Open |
| Project: | MariaDB Connector/J |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Major |
| Reporter: | Korbinian Bachl | Assignee: | Diego Dupin |
| Resolution: | Unresolved | Votes: | 6 |
| Labels: | None | ||
| Environment: |
payara 4 with eclipselink 2.6.2; mariadb 10.2.24 on ubuntu 18.04 |
||
| Description |
|
all fine till j connector 2.3.0 - 2.4.1 and 2.4.0 throws it! on updating/ creating an jpa entity it happens that errors occur: Internal Exception: java.sql.SQLSyntaxErrorException: (conn=105) Table 'databasename.SEQUENCE' doesn't exist [2019-05-14T10:08:55.422+0200] [Payara 4.1] [INFORMATION] [] [] [tid: _ThreadID=37 _ThreadName=http-thread-pool::http-listener-2(1)] [timeMillis: 1557821335422] [levelValue: 800] [[ |
| Comments |
| Comment by Diego Dupin [ 2019-05-15 ] | |
|
It must be related to https://jira.mariadb.org/browse/CONJ-654. _checking eclipselink source to confirm by my side _ | |
| Comment by Korbinian Bachl [ 2019-05-15 ] | |
|
ok, I added "useMysqlMetadata" "true" into the name + value of the JDBC connection pool properties, next to user, port, password etc. Caused by: Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.6.4.qualifier): org.eclipse.persistence.exceptions.DatabaseException PS: reverted to connector 2.3.0 - all working fine.... | |
| Comment by Gonzalo García [ 2019-08-06 ] | |
|
Hello, I have the same problem, just to complement, when I create the EntityManagerFactory (EMF) manually (without any application server / container) it works fine. | |
| Comment by Sebastian Knop [ 2019-08-23 ] | |
|
Since MySQL doesn't support sequences, using useMysqlMetadata causes Eclipselink/JPA to not generate sequences. And Eclipselink doesn't explicitly support MariaDB, so using the connector without useMysqlMetadata causes Eclipselink to generate SQL for sequences that's invalid for MariaDB (Data type NUMBER and VARCHAR without length). | |
| Comment by Mario Simaremare [ 2020-04-22 ] | |
|
This bug still appears in version 2.6.0 stable release. | |
| Comment by Tomasz [ 2020-04-24 ] | |
|
Very annoying bug affecting basic database functionality. | |
| Comment by Jean-Claude Stritt [ 2020-05-12 ] | |
|
Same problem in may 2020. I have downgrade from 2.5.2 to 2.3.0. Please correct this. | |
| Comment by Kim Gabrielsen [ 2021-02-04 ] | |
|
Problem is still here in feb 2021 and v 2.7.1. I have to go back to 2.3 like everybody else. | |
| Comment by Jan Vonde [ 2021-08-13 ] | |
|
August 2021 and v2.7.4. Same problem, reverting to 2.3.0 and everything is working again... | |
| Comment by Diego Dupin [ 2021-11-08 ] | |
|
DatabaseMetaData.getDatabaseProductName() returns 'MariaDB' if server is MariaDB. That's not a bug, it's the expected behavior. eclipselink doesn't support explicitily MariaDB, ok, but there is no need to revert to a previous version, only to enable useMysqlMetadata option, like setting connection string to something like :
Connector will then return 'MySQL' event for MariaDB database, permitting eclipselink to works ok. | |
| Comment by Korbinian Bachl [ 2021-11-09 ] | |
|
@Diego Dupin So your solution to this after over 2 years is to add the property "useMysqlMetadata" with value "true" to the additional properties of the JDBC Connection Pool Properties for any server using eclipselink (like payara and glassfish) ? Let me give you 1 short hint: I did this in 2019 and I also did this just now with a fresh payara 2021.6 + mariadb-java-client-2.7.4.jar in /domain/lib and the mentioned useMysqlMetadata=true and it still fails: Internal Exception: java.sql.SQLSyntaxErrorException: (conn=39) Table 'shopbdb.SEQUENCE' doesn't exist Caused by: Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.7.7.payara-p3): org.eclipse.persistence.exceptions.DatabaseException Caused by: java.sql.SQLSyntaxErrorException: (conn=39) Table 'shopbdb.SEQUENCE' doesn't exist Caused by: org.mariadb.jdbc.internal.util.exceptions.MariaDbSqlException: Table 'shopbdb.SEQUENCE' doesn't exist Caused by: java.sql.SQLException: Table 'shopbdb.SEQUENCE' doesn't exist So? PS: version of eclipslink: Caused by: Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.7.7.payara-p3): org.eclipse.persistence.exceptions.DatabaseException | |
| Comment by Korbinian Bachl [ 2021-11-09 ] | |
|
Follow up: after digging deeper into eclipselink and maridb connector it seems that by using JTA via data source the parameter of the connection itself doesnt get respected from eclipselink. Furthermore https://github.com/eclipse-ee4j/eclipselink/issues/883 is still pointing to future. However, you can add an property to your persistence.xml to have eclipselink ignore all it gets and instead force it to talk "mysql" dialect ignoring everything else: <properties> this way connector 2.4.+ will work! |