On Saturday 01 December 2007 09:53:30 am Ryan Moquin wrote: > I think my main concern with this (hence why I'm asking general advice) is > that sometimes a unit test might work against HSQL and fail against another > database such as MSSQL? Or am I worrying about something I shouldn't? > > I did make some progress finally though, I kept connection pooling on in my > unit tests since I don't think it's possible for me to run my build without > it, and then I stopped using the maven-sql-plugin and went back to the > hibernate ddl create-drop method of recreating my schema (which I ran into > problems with, which caused me to go to maven-sql-plugin previously). That > alleviates the database in use when the plugin tries to drop and recreate > it. > > Of course, this doesn't answer whether or not I should be using an inmem > database like HSQL ... I think depending on people's experiences on the > pros and cons will be what will cause me to switch. I'm just worried that > I might lose some accuracy in my unit tests going to that approach?
Speaking theoretically, a *unit test* for your application should not be concerned with the specific database being used under the covers. That responsibility would fall under the unit tests of the code actually communicating with the database (Hibernate). I stressed the term unit test above, because it has a very specific meaning that is actually not strictly adhered to alot of times; not saying this is good or bad, just saying it is the case. So really it just comes down to personal choice. The usual (productive) middle ground between theory and pragmatism in this realm is to use an in memory database (I actually prefer H2 over HSQLDB) -- Steve Ebersole Hibernate Project Lead http://hibernate.org Principal Software Engineer http://redhat.com http://jboss.org --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
