Re: [Hibernate] JUnit testing of hibernate code segments that need a datasource

2003-12-12 Thread Per Thomas Jahr
I have just done the same, but I don't create a new datasource outside the container. When you run code outside the container you have to use another hibernate.cfg.xml where you specify driver_class, url, username and password. My hibernate.cfg.xml (for use in Tomcat) looks like this: java:com

RE: [Hibernate] JUnit testing of hibernate code segments that need a datasource

2003-12-10 Thread Dmitri Colebatch
My suggestion would be to have a different hibernate configuraiton for your tests. I have a base test class that creates a mock setup of instances in a fresh test database and then run the tests against that before cleaning up. There are dummy JNDI implementations around though if you'd prefer th

RE: [Hibernate] JUnit testing of hibernate code segments that need a datasource

2003-12-10 Thread Eric Pugh
What you could do is have multiple setups so that some junit tests use the container, others use it from a differnet location. You may be able to use a container (Look at spring or the Avalon wrapper) to handle this. Just configure two copys of Hibernate depending on where you need your datasour