Yeah, negative keys is probably the way to go. Maybe we should have a
"dev" and "prod" profile in pom.xml. For "dev", sample-data.xml (or
test-data.xml) would be used (with negative keys). For production, a
default-data.xml would be used. This would have default values - for
example, an admin user and the default roles. Thoughts?

Matt

On 9/8/07, Rob Hills <[EMAIL PROTECTED]> wrote:
> Hi Matt,
>
> On 8 Sep 2007 at 2:35, Matt Raible wrote:
>
> > The easiest solution is don't use Oracle. ;-) Or maybe use PostgreSQL
>
> Sorry, I should have mentioned, I'm using PostgreSQL.  I'll not start any
> flame wars by talking about my opinion of Oracle...
>
> > since that's very similar. In all seriousness, there should be an easy
> > way to solve this problem, but I don't know it. There is a
> > SequenceGenerator annotation - maybe that can be used somehow?
> >
> >   @Id
> >   @SequenceGenerator(
> >       name="EMP_SEQ_GEN",
> >       sequenceName="emp_sequence"
> >   )
> >   @GeneratedValue(
> >       strategy = GenerationType.SEQUENCE,
> >       generator="EMP_SEQ_GEN"
> >   )
> >   public Integer getId() {
> >     return this.id;
> >   }
>
> Those look like Oracle-specific sequences to me and it seems a shame to
> have to put in stuff like that.
>
> Maybe I'm misunderstanding the problem, but it seems to me that this
> problem should affect all Databases - some data is inserted into tables
> without updating the primary key generating system so if any of the keys in
> your inserted data are less than the value in the primary key generating
> system (hibernate_sequence in our case), you get a duplicate key error.
>
> Since this seems to be a test-data problem I believe that's where the
> solution should be located - ideally there'd be a way of updating the
> sequence using an appropriate entry in the sample-data.xml file.  I had a bit
> of a scout around the DBUnit docco but unfortunately didn't see anything
> that looked like an obvious candidate :-(
>
> Is there a way of putting something into the relevant part of the pom.xml that
> executes a HQL statement or something like that?
>
> Meanwhile, I think I'll use the negative id idea mentioned in the discussion
> following the JIRA entry: http://issues.appfuse.org/browse/APF-718
>
>
> 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]
>
>


-- 
http://raibledesigns.com

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to