Spring-Data-Jdbc with ArcadeDB

236 Views Asked by At

Using a Spring-Data-JDBC repository and ArcadeDB as persistence, a simple "count()" runs on an error.

2022-07-10 12:54:33.755 DEBUG 14320 --- [           main] o.s.jdbc.support.JdbcTransactionManager  : Creating new transaction with name [org.springframework.data.jdbc.repository.support.SimpleJdbcRepository.count]: PROPAGATION_REQUIRED,ISOLATION_DEFAULT,readOnly
2022-07-10 12:54:33.760 DEBUG 14320 --- [           main] o.s.jdbc.support.JdbcTransactionManager  : Acquired Connection [org.postgresql.jdbc.PgConnection@9263c54] for JDBC transaction
2022-07-10 12:54:33.797 DEBUG 14320 --- [           main] o.s.jdbc.datasource.DataSourceUtils      : Setting JDBC Connection [org.postgresql.jdbc.PgConnection@9263c54] read-only
2022-07-10 12:54:33.802 DEBUG 14320 --- [           main] o.s.jdbc.support.JdbcTransactionManager  : Switching JDBC Connection [org.postgresql.jdbc.PgConnection@9263c54] to manual commit
2022-07-10 12:54:34.802 DEBUG 14320 --- [           main] o.s.jdbc.core.JdbcTemplate               : Executing SQL query [SELECT COUNT(*) FROM `Team`]

org.springframework.jdbc.BadSqlGrammarException: StatementCallback; bad SQL grammar [SELECT COUNT(*) FROM `Team`]; nested exception is org.postgresql.util.PSQLException: ERROR: Syntax error on parsing query: Encountered " <READ> "READ "" at line 1, column 7. Was expecting one of:
<EOF> 
<ISOLATION> ...
";" ...
<ISOLATION> ..

But the same sql-query executed in a plain JdbcTemplate runs succesfully:

jdbcTemplate.execute("select count(*) from `Team`")

I suspect that the error occurs because the repository call runs the sql-statement in a transaction, whereas the plain JdbcTemplate call is invoked without a transaction.

My question is: Can I make ArcadeDB work with a Spring transaction manager? If not, can I use the repositories of Spring Data without transactions?

1

There are 1 best solutions below

0
On

Your problem might be caused by the release you are using.
Recent versions fixed an annoying bug with the Postgres driver.

From the error, it looks like a "READ" keyword was used. It could be the Spring Data layer that added it.