Panache Data REST: Update method requires at least two connections
See original GitHub issueDescribe the bug I have a resource called:
public interface ApplicationResource extends PanacheEntityResource<ApplicationEntity, Long> {
}
This endpoint exposes all the REST methods. The problem is that the PUT method (update) requires a minimal of two connections. So, if we limit the amount of connections using this property:
quarkus.datasource.jdbc.max-size=1
The update method will fail with:
Caused by: org.hibernate.exception.GenericJDBCException: Unable to acquire JDBC Connection
at org.hibernate.exception.internal.StandardSQLExceptionConverter.convert(StandardSQLExceptionConverter.java:47)
at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:113)
at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:99)
at org.hibernate.resource.jdbc.internal.LogicalConnectionManagedImpl.acquireConnectionIfNeeded(LogicalConnectionManagedImpl.java:111)
at org.hibernate.resource.jdbc.internal.LogicalConnectionManagedImpl.getPhysicalConnection(LogicalConnectionManagedImpl.java:138)
at org.hibernate.engine.jdbc.internal.StatementPreparerImpl.connection(StatementPreparerImpl.java:50)
at org.hibernate.engine.jdbc.internal.StatementPreparerImpl$5.doPrepare(StatementPreparerImpl.java:149)
This is a regression issue that was entered as part of this commit: https://github.com/quarkusio/quarkus/commit/8c76e39060f6b288eaaeeb28bc477b33a972a40f. In this commit, the @Transactional
annotations were removed from the REST methods and added into the inner methods. The problem with the update implementation is that is calling two inner methods (get and update).
Expected behavior All REST methods should use only one connection.
Actual behavior PUT REST method needs at least two connections.
To Reproduce
1- git clone https://github.com/Sgitario/beefy-scenarios
2- cd beefy-scenarios/014-quarkus-panache-with-transactions-xa
3- git checkout reproducer_15369
4-mvn clean install (it needs to have built quarkus master locally)
This example is basically doing this:
- Create a resource
- Update the existing resource -> here it fails
Environment (please complete the following information):
- Quarkus version or git rev: 999-SNAPSHOT (1.12.1.Final)
Issue Analytics
- State:
- Created 3 years ago
- Comments:10 (6 by maintainers)
Just wanted to point that out. I will nevertheless add the transaction.
OK, right, single transaction is definitely a requirement, we can agree on that 😃