Re: Basic DAO-"Service"-Test-Setup

2012-02-14 Thread stebac
Hi Kalle, > What is the mock used for (particularly in this case)? > You want to use the SessionSource to create a new Session if the > execution of your operation lasts longer than the lifetime of the > request is. If you are injecting a session, T5 manages the lifetime of > it and closes it at

Re: Basic DAO-"Service"-Test-Setup

2012-02-13 Thread Kalle Korhonen
On Mon, Feb 13, 2012 at 1:19 AM, stebac wrote: > What is the mock used for (particularly in this case)? > I commented out these two lines and it still worked, what is the purpose of > the SessionSource? Of course it "works" if you don't need the SessionSource (which is a T5 concept, not Hibernate

Re: Basic DAO-"Service"-Test-Setup

2012-02-13 Thread stebac
Hi Kalle, thank you very much for your quick response! I saw this approach before but did not understand it entirely. Maybe a shall supply a little bit more information about my situation: I have a typical t5-service consisting of an interface an the corresponding implementation. The Service is

Re: Basic DAO-"Service"-Test-Setup

2012-02-10 Thread Kalle Korhonen
The following is what I use. I use Mockito for mock-ups and basically it's a real Hibernate session (and factory) with a mocked-up T5 HibernateSessionSource: public abstract class PersistenceTest { protected Session session; protected Transaction transaction; protected stat