This is a strategy I have used in the past on MS SQL with great success - it makes it very easy to partition test data from production data in the same database. I think there may be a subtler issue here though - the sample-data.xml is also used to populate the inital set of users in the database, which should be inserted using positive ids. Do we have an issue with updating the sequences on Oracle (and similar dbs) when inserting data using DBUnit?
Mike On 3/25/07, Matt Raible <[EMAIL PROTECTED]> wrote:
I don't have a problem with this change. Are you saying that the default sample-data.xml should have negative values for its ids? I'm assuming we should use negative values in the tutorials as well? Thanks, Matt On 3/24/07, donleyp <[EMAIL PROTECTED]> wrote: > > > I've just started using AppFuse on a project at work and it really > helped me > get up and running quickly. Thanks to all the devs on this project for > the > great product. > > We use Oracle here and I did not want to start a project using MySQL and > > possibly get stuck with a bunch of migration problems right before > release, > so the first thing I did was to deviate from the Quick Start guide and > plug > in a dependency to the Oracle drivers and the necessary configuration > parameters into my POM (this was a breeze: another tip of the hat to you > guys). > > Everything worked great except for the integration tests! They kept > failing > with constraint violations. I pressed on and added my first persistent > object with attendant UI using the tutorial as a guide. Again this was a > breeze, but I was getting the same integrity violations on my first > three > attempts to save a new object. After the first three attempts, > everything > worked great. This behavior is what tipped me off. The oracle sequence > object that is created by the hbm2ddl task is initialized to 1. My > sample > data was exactly three rows numbered 1, 2, and 3. This was also the case > > with the two sample users in sample-data.xml. > > I actually have a solution to my own problem... > > Setting the "id" column values in all of the sample data to negative > values > will safely place them outside the range of values generated by the > sequence. This is actually a pretty good practice that I have used in > the > past to make test data easier to handle. Not only does it avoid > collisions > with various artificial key generators, it also makes it easy to insert > and > clean out test data in production databases for troubleshooting. > > Does anyone else think it would be a good idea for appfuse to adopt this > policy of using negative ids for sample data, or are there any databases > out > there that would choke on this? Obviously, Oracle is fine. I know that > SQL > Server and MySQL would have no problem with it either. > > Donley > > -- > View this message in context: > http://www.nabble.com/Integration-Test-Failures-When-Using-Oracle-tf3461237s2369.html#a9657230 > Sent from the AppFuse - User mailing list archive at Nabble.com. > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > -- http://raibledesigns.com
