From 0dc30c914fd845d86a3a9e5b1c65d153785b2ddd Mon Sep 17 00:00:00 2001 From: Adib Saikali Date: Wed, 5 Feb 2014 14:12:31 -0500 Subject: [PATCH] Add a tip clarifying that TestNG @BeforeClass, @BeforeSuite can not be used with the Spring @Transactional --- src/asciidoc/index.adoc | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/asciidoc/index.adoc b/src/asciidoc/index.adoc index 759f21d6c000..255fc8260523 100644 --- a/src/asciidoc/index.adoc +++ b/src/asciidoc/index.adoc @@ -19968,6 +19968,16 @@ __within__ a transaction. In addition, methods annotated with `@BeforeTransactio to run within a transaction. ==== +[TIP] +==== + +When using TestNG `@BeforeClass`,`@BeforeSuite` methods can not be used with the +`@Transactional` annotation, as they are considered non transactional methods by the +the spring text contetxt framework. However, you can inject a `PlatfromTransactionManager` +or a `TransactionTemplate` and use it within `@BeforeClass` method to perform a +transaction. +=== + The following JUnit-based example displays a fictitious integration testing scenario highlighting several transaction-related annotations. Consult the <> section for further information