Hello,

That doesn't sound like how spring works. A @Transactional method will
always commit by default, or rollback on exception. But there is perhaps
some Spring/JUnit feature that extends JUnit in the desired way?

I don't know spring well enough. Perhaps you can get an answer on Stack
Overflow:
https://stackoverflow.com

Thanks,
Lukas

On Thu, Oct 18, 2018 at 4:03 PM <[email protected]> wrote:

> Hi all,
>
> We ran into problem in our integrationTest. We are using Spring Boot +
> Postgre +JPA(hibernate) + Jooq. Besides other things (like queries and so
> on) we are using DSLContext obj.(dsl) for creating some dynamic tables. Now
> our issue lays on integration Tests.
>
> For tests, we are using H2 db.
>
> All int. test extends  this class def:
>
> ContextConfiguration
> @SpringBootTest(webEnvironment = RANDOM_PORT)
> @ActiveProfiles("test")
> @Transactional
> // We tried also @Rollback annotation doesn't work either.
> class IntTestWithContext extends Specification {
> .....
> .....
> }
>
> We have test, where we are trying to validate, that in some cases, table
> is created and for other actions is deleted.
> My understanding of @Transactional was, that after each test, all changes
> should be rollbacked to previous state. We had also annotation @Rollback
> for that purpose, but it doesn't worked either. Issue is when we run in our
> test: dsl.dropTableIfExists('DYNAMIC_TABLE_1').execute(); This script
> however triggers commit, which actually push all changes made in test into
> DB. When this test ends, then all what was commited is stored in h2 Db and
> make other test failing. My question is pretty straight forward. What can
> we do with this.
> Expected behavior is : using jooq in test with all changes rollbacked in
> the end of the test.
>
> --
> You received this message because you are subscribed to the Google Groups
> "jOOQ User Group" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups "jOOQ 
User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to