On MIFOS, we are successfully using Mayfly and Hibernate together, but there are some catches (and some future work - for me and/or other volunteers - in terms of making this work better).
First of all, MIFOS is currently on Hibernate 3.0beta4. I suspect later versions of Hibernate work too, but it would be nice to download Mayfly and Hibernate and try it out on some kind of "hello world" situation.
Next, there's the Hibernate dialect. The one we are using in MIFOS is checked in to MIFOS as MayflyDialect. It would be nice to submit this to Hibernate as a patch. I have been meaning to do this, but just haven't gotten around to it. For a while, I thought it might be changing frequently, but that hasn't been true lately.
Anyway, enough of the boring stuff. The interesting part is whether we can hook up the features of Mayfly which distinguish it from Hypersonic and the rest. For example, let's take the feature of wanting to give each test a fresh database. Suppose we have a static DataStore which contains all the tables and perhaps some data which all tests should start with (in MIFOS, getStandardStore() in DatabaseSetup ). Now, in Hibernate one typically creates a SessionFactory once (not on every test, as it is expensive to make one), and the SessionFactory has the JDBC URL built in. So how do we give a new Database for each test while being able to re-use the SessionFactory? Well, what I've done so far is open my Session with the SessionFactory#openSession(Connection connection) method. I'm probably best off just pointing to an example: testGetAllParameters in ReportsPersistenceTest.
So, anyone found better techniques? This is a good subject for collaboration, not just because it is a way to share the work, but also because everyone's way of setting these things up tends to be slightly different.
Tuesday, April 03, 2007
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment