[CONJ-1074] Unable to execute OPTIMIZE TABLE Created: 2023-05-03 Updated: 2023-05-11 Resolved: 2023-05-11 |
|
| Status: | Closed |
| Project: | MariaDB Connector/J |
| Component/s: | 2.7 compatibility |
| Affects Version/s: | 3.1.2, 3.1.4 |
| Fix Version/s: | N/A |
| Type: | Bug | Priority: | Major |
| Reporter: | Rick Tuk | Assignee: | Diego Dupin |
| Resolution: | Not a Bug | Votes: | 0 |
| Labels: | None | ||
| Environment: |
org.hibernate.orm.hibernate-core 6.1.7.Final |
||
| Description |
|
When trying to execute an OPTIMIZE TABLE query: WARN o.h.e.jdbc.spi.SqlExceptionHelper - SQL Error: -1, SQLState: HY000 This query used to work perfectly on the 2.x.x version of the connector I have tested with connector version 3.1.2 and 3.1.4 |
| Comments |
| Comment by Diego Dupin [ 2023-05-03 ] | |||
|
3.x version of driver now respect specification for executeUpdate : see https://docs.oracle.com/javase/8/docs/api/java/sql/PreparedStatement.html
in your case, replacing
by
like
will solve this issue | |||
| Comment by Rick Tuk [ 2023-05-05 ] | |||
|
entityManager,createNativeQuery() returns a Query object which only has the executeUpdate() method: I don't see how to get this to work | |||
| Comment by Diego Dupin [ 2023-05-05 ] | |||
|
ah yes, must be changed to a command that will call executeQuery, so that must be a jakarta.persistence.Query.getResultList() to execute under the hood org.mariadb.jdbc.Statement.executeQuery | |||
| Comment by Rick Tuk [ 2023-05-05 ] | |||
|
Thank you for your help, getResultList() fixes my problem! |