Have you tried using a UUID instead? That solved a LOT of our problems!
On 9/12/07, saki <saki@xxxxxxxx> wrote:
>
> Probably to late, but may be it will help ...
>
> Per doc this generator should not be used in multiprocess enviroment. It's
> not entirely clear from the doc, but if you look at code, you would find out
> the generator reads the value from database only first time when it is used
> and than it only every time increments this value ...
>
> "increment generates identifiers of type long, short or int that are unique
> only when no other process is inserting data into the same table. Do not use
> in a cluster."
>
>
>
>
> Kumar-10 wrote:
> >
> > I have a question related to Hibernate (I am not sure if this is the right
> > forum to ask this. Please direct me to the right one if so).
> >
> > We have a web application that uses Hibernate's increment generator to
> > insert rows in DB2 tables. We have another Java application that inserts
> > rows in the same DB2 tables using Hibernate's increment generator. These
> > two
> > applications are totally independent of each other and both have mappings
> > like so:
> >
> > <id name="objectId" type="int" column="TABLE_ID">
> > <generator class="increment"/>
> > </id>
> >
> > My question is: If both applications simultaneously try to insert rows
> > into
> > the same table, will we get a ConstraintViolationException? I read that
> > the
> > increment generator should not be used in a clustered environment (
> > http://www.hibernate.org/hib_docs/v3/reference/en/html/mapping.html). I am
> > curious to know how Hibernate works internally. Does it lock the database
> > until it generates the max. id and finishes inserting the corresponding
> > row
> > - all in one transaction?
> >
> > Ideally, I guess we should have had the the database generate sequence
> > numbers and use Hibernate's sequence generator. But at this point, I think
> > it's a bit too late to make such a big change unless absolutely required.
> >
> > Please advise. Thanks in advance as always.
> >
> > Kumar
> >
> >
>
> --
> View this message in context:
> http://www.nabble.com/Hibernate---increment-generator-tf3396487.html#a12639733
> Sent from the CinJUG - Users mailing list archive at Nabble.com.
>
>
> ---------
> You may unsubscribe from this mailing list
> by sending a blank email addressed to:
> users-unsubscribe@xxxxxxxxxx
>
> --
> Find additional help by sending a blank email
> addressed to:
> users-help@xxxxxxxxxx
>
>
|