Hi, for oracle you could set the value to "start with 10001": @hibernate.generator-param name="parameters" value="start with 10001"
But the real solution should be that the id's are generated already from the corresponding sequence when the initiall data i.e. data from sample-data.xml are inserted into the database by dbunits CLEAR_INSERT. Kia David Bernard wrote: > > Matt, > > The general problem is that the id generator native for postgresql uses a > postgresql sequence called "hibernate_sequence" which starts at 1 and the > dbunit loads sample data which has objects with ids 1,2 etc leading to > primary key clashes when saving new objects. > > The method I used to work around this was to define the id's with > generator sequence using a different database sequence and to initialise > the sequence to a number outside the range of the sample data. > > * @hibernate.id column="id" generator-class="sequence" > unsaved-value="null" > * @hibernate.generator-param name="sequence" > value="role_number_sequence" > * @hibernate.generator-param name="parameters" value="start 10001" > > > Unfortunately there does not seem to be a way to initialise the > "hibernate_sequence" sequence to say "1000" which would place it "past" > all the sample data. I tried doing it with dbunit but it is not supported. > > Appfuse Options for generic support: > > 1. Find some way to initialiise the "hibernate_sequence" out of the way of > the sample data. > Or > 2. Change the sample data to be out of the way of the sequence eg > 1000,1001 etc. > (This is not safe as there could be a clash if a new user is added after > 1000 new objects are created) > > David Bernard > -- View this message in context: http://www.nabble.com/unique-constraint-violated-when-running-test-all-tf1447523s2369.html#a7834750 Sent from the AppFuse - User mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
