Also notice, if you use Propagation.REQUIRES_NEW, you won't be able to roll
that back from your test transaction.

On Fri, Oct 19, 2018 at 6:33 PM Rafael Ponte <[email protected]> wrote:

> As Lukas said, you probably need to guarantee the same data source (and
> connection) for both statements (Repository and jOOQ dsl). It’s because
> your test has not committed the transaction yet! I mean, if during the
> tests you’re using a connection pool (like c3p0 or hikariCp) the chances
> are your two objects are working with different database connections!
> Without explicit commit it won’t work!
>
> One approach I like to use when writing integration tests with Spring is
> configure the DataSource with the SingleConnectionDataSource class, so that
> all beans in the environment test use the same database connection and
> participate in the same transaction as well! It has been working for years
> in my projects!
>
> Btw, if you’re using JPA you need to flush the persistence context
> explicitly in you test case.
> On Fri, 19 Oct 2018 at 06:37 Lukas Eder <[email protected]> wrote:
>
>> It looks like, that @transaction on spring level isn't finished (which is
>>> not finished) and dsl is not capable to see the values.  Is there any way
>>> how to sync those 2 approaches ?
>>>
>>
>> This depends on how you configure your dsl. It must obviously use the
>> same data source as your other code in order to operate in the same
>> transaction. Also, if your save method uses JPA behind the scenes, do make
>> sure JPA changes are flushed to the database. jOOQ cannot query JPA's first
>> and second level caches.
>>
>> --
>> 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.
>>
> --
> Rafael Ponte
> TriadWorks | Formação Java
> http://cursos.triadworks.com.br
>
> --
> 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