users@jersey.java.net

Re: [Jersey] Spring, transaction and Jersey test framework

From: reno <reno.rkcrew_at_free.fr>
Date: Sat, 23 Oct 2010 21:51:57 +0200

Leo,

i've never faced to the problem...
we're using it everyday (jersey uses a service layer that supports
spring transactions with a MySQL InnoDB database): no problem.
1) is your database is transactional ?
2) are you using a service layer to isolate jersey and the service (with
daos and more) ???
...

S.
> Hello,
> I'm using the jersey-test-framework to test my Jersey Webservice.
> I launch my unit tests with JUNIT4 using the spring annotations
> @Transactional and @TransactionConfiguration(defaultRollback = true)
> to avoid putting unused test data into database.
> Apparently, these annotations are not taken into account by my
> GrizzlyWebTestContainer because data processed in my webservice is
> inserted in my database and not removed afterward.
> It sounds like it is a context problem : Grizzly Webapp and JUnit test
> are not using the same context, and then are working in differents
> transactions.
>
> Have you ever faced this problem? Any solution?
> Thanks in advance,
> Leo