-
Notifications
You must be signed in to change notification settings - Fork 199
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix nested transaction savepoint handling in JDBC transaction manager (…
…#3047) * Fix nested transaction savepoint handling in JDBC transaction manager * Fix comments * Fix the test. * Use connection.setSavepoint() without passing name. * Update savepoint operations for Hibernate transaction manager as well. * Renamed test * Removed transaction savepoint error checks from AbstractDefaultTransactionOperations class
- Loading branch information
1 parent
7dfac6f
commit 9fdf0e9
Showing
15 changed files
with
228 additions
and
10 deletions.
There are no files selected for viewing
14 changes: 14 additions & 0 deletions
14
data-jdbc/src/test/groovy/io/micronaut/data/jdbc/mariadb/MariaTransactionsSpec.groovy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package io.micronaut.data.jdbc.mariadb | ||
|
||
import io.micronaut.data.jdbc.AbstractJdbcTransactionSpec | ||
import io.micronaut.data.jdbc.mysql.MySqlBookRepository | ||
import io.micronaut.data.tck.repositories.BookRepository | ||
|
||
class MariaTransactionsSpec extends AbstractJdbcTransactionSpec implements MariaTestPropertyProvider { | ||
|
||
@Override | ||
Class<? extends BookRepository> getBookRepositoryClass() { | ||
return MySqlBookRepository.class | ||
} | ||
|
||
} |
23 changes: 23 additions & 0 deletions
23
data-jdbc/src/test/groovy/io/micronaut/data/jdbc/mysql/MySqlTransactionsSpec.groovy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package io.micronaut.data.jdbc.mysql | ||
|
||
import io.micronaut.data.jdbc.AbstractJdbcTransactionSpec | ||
import io.micronaut.data.tck.repositories.BookRepository | ||
|
||
class MySqlTransactionsSpec extends AbstractJdbcTransactionSpec implements MySQLTestPropertyProvider { | ||
|
||
@Override | ||
Class<? extends BookRepository> getBookRepositoryClass() { | ||
return MySqlBookRepository.class | ||
} | ||
|
||
@Override | ||
boolean failsInsertInReadOnlyTx() { | ||
return true | ||
} | ||
|
||
@Override | ||
boolean cannotInsertInReadOnlyTx(Exception e) { | ||
assert e.cause.message == "Connection is read-only. Queries leading to data modification are not allowed" | ||
return true | ||
} | ||
} |
15 changes: 15 additions & 0 deletions
15
data-jdbc/src/test/groovy/io/micronaut/data/jdbc/oraclexe/OracleTransactionsSpec.groovy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package io.micronaut.data.jdbc.oraclexe | ||
|
||
import io.micronaut.data.jdbc.AbstractJdbcTransactionSpec | ||
import io.micronaut.data.jdbc.postgres.PostgresBookRepository | ||
import io.micronaut.data.jdbc.postgres.PostgresTestPropertyProvider | ||
import io.micronaut.data.tck.repositories.BookRepository | ||
|
||
class OracleTransactionsSpec extends AbstractJdbcTransactionSpec implements OracleTestPropertyProvider { | ||
|
||
@Override | ||
Class<? extends BookRepository> getBookRepositoryClass() { | ||
return OracleXEBookRepository.class | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
data-jdbc/src/test/groovy/io/micronaut/data/jdbc/sqlserver/SqlServerTransactionsSpec.groovy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package io.micronaut.data.jdbc.sqlserver | ||
|
||
import io.micronaut.data.jdbc.AbstractJdbcTransactionSpec | ||
import io.micronaut.data.tck.repositories.BookRepository | ||
|
||
class SqlServerTransactionsSpec extends AbstractJdbcTransactionSpec implements MSSQLTestPropertyProvider { | ||
|
||
@Override | ||
Class<? extends BookRepository> getBookRepositoryClass() { | ||
return MSBookRepository.class | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
...src/test/groovy/io/micronaut/transaction/hibernate6/OracleHibernateTransactionSpec.groovy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package io.micronaut.transaction.hibernate6 | ||
|
||
import io.micronaut.data.model.query.builder.sql.Dialect | ||
import io.micronaut.data.tck.tests.TestResourcesDatabaseTestPropertyProvider | ||
|
||
class OracleHibernateTransactionSpec extends HibernateTransactionSpec implements TestResourcesDatabaseTestPropertyProvider { | ||
|
||
@Override | ||
Dialect dialect() { | ||
return Dialect.ORACLE | ||
} | ||
|
||
@Override | ||
Map<String, String> getProperties() { | ||
return TestResourcesDatabaseTestPropertyProvider.super.getProperties() + [ | ||
"datasources.default.name" : "myoracledb", | ||
'jpa.default.properties.hibernate.hbm2ddl.auto': 'create-drop', | ||
'jpa.default.properties.hibernate.dialect' : 'org.hibernate.dialect.OracleDialect' | ||
] | ||
} | ||
|
||
@Override | ||
boolean supportsReadOnlyFlag() { | ||
return true | ||
} | ||
|
||
} |
29 changes: 29 additions & 0 deletions
29
.../test/groovy/io/micronaut/transaction/hibernate6/SqlServerHibernateTransactionSpec.groovy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package io.micronaut.transaction.hibernate6 | ||
|
||
|
||
import io.micronaut.data.model.query.builder.sql.Dialect | ||
import io.micronaut.data.tck.tests.TestResourcesDatabaseTestPropertyProvider | ||
|
||
class SqlServerHibernateTransactionSpec extends HibernateTransactionSpec implements TestResourcesDatabaseTestPropertyProvider { | ||
|
||
@Override | ||
Dialect dialect() { | ||
return Dialect.SQL_SERVER | ||
} | ||
|
||
@Override | ||
Map<String, String> getProperties() { | ||
return TestResourcesDatabaseTestPropertyProvider.super.getProperties() + [ | ||
"datasources.default.name" : "mymssqldb", | ||
'jpa.default.properties.hibernate.hbm2ddl.auto' : 'create-drop', | ||
'jpa.default.properties.hibernate.dialect' : 'org.hibernate.dialect.SQLServerDialect', | ||
'test-resources.containers.mssql.accept-license' : 'true' | ||
] | ||
} | ||
|
||
@Override | ||
boolean supportsReadOnlyFlag() { | ||
return true | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters