Hi Matt, On 21 Sep 2007 at 22:35, Matt Raible wrote:
> Yes, this is probably possible. > > You could also try turning off foreign keys on import: > > http://raibledesigns.com/rd/entry/dbunit_tip_turn_off_foreign Hmmm, that looks like it has potential for a much better generic solution to this problem - the tip, and associated discussion, talks about ways of turning off Referential Integrity Checking while loading test data. However, thinking more about it, it does assume that our test data has inherent referential integrity, it's just being loaded in the wrong order. What happens if there's a real problem with the referential integrity of the data? Do we then get obscure and difficult-to-diagnose errors later when (presumably) referential integrity is turned back on for our unit tests (as I believe it should be)? My other problem with that solution is that I'm currently using HSQLDB as my test database and it appears to have no way of turning off Referential Integrity Checks via the URL - from my reading of the HSQLDB docco, you have to use an SQL SET command to do that. Does anyone else have any thoughts on this? Or does everyone else get their model perfect before running appfuse:gen so it isn't a problem for you? > On 9/21/07, Rob Hills <[EMAIL PROTECTED]> wrote: > > Hi All, > > > > Over the past few days, I've had to run appfuse:gen over my model classes > > numerous times and I've discovered some behaviour I think could be > > improved. > > > > The problem arises when you have dependencies (eg one-to-many). When > > inserting test data via sample-data.xml, the data needs to be inserted in > > the > > correct order (ie parent data before child data), or else you get Integrity > > Constraint Violation errors when DBUnit runs. > > > > I suspect it's a bit much to expect appfuse:gen to be able to nut out these > > relationships and sort the sample-data.xml into the correct order. However, > > it would be nice if it didn't mess up my manual sorting in subsequent runs. > > > > AFAICT, if you run appfuse:gen over a pojo a second or subsequent time, > > when it comes to updating sample-data.xml, it seems to locate the existing > > data for that entity (presumably via the MyPojo-START and MyPojo-END > > comment tags), blat it and then add the new version to the end of the file. > > > > This means I often have to manually re-order the sample-data.xml file > > afterwards. > > > > It would be nice if appfuse:gen could locate the old data, blat everything > > between the xx-START and xx-END comments, but leave the comments in > > place and then insert the new data between them, hence preserving the > > original ordering. Is that possible? Cheers, Rob Hills Waikiki, Western Australia Mobile +61 (412) 904-357 Fax: +61 (8) 9529-2137 --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
