You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@openjpa.apache.org by Udi <Sa...@gmail.com> on 2009/08/03 15:24:37 UTC
EntityExistsException issue
Hey,
I have this case:
class Book{
@id
protected long id;
private static number = 0;
@prePersist
private void makeSomeID(){
id = ++number;
}
}
class Persister{
public static void main(...){
while (true){
em.persist(new Book());
}
}
}
I don't know why I sometimes get EntityExistsException.
The openJPA documentation says nothing about this exception. Why do I get
it?
ps - I know it's not compiling, I just can't copy the code from the
workspace...
thanks
Udi
--
View this message in context: http://n2.nabble.com/EntityExistsException-issue-tp3377645p3377645.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.
Re: EntityExistsException issue
Posted by Jean-Baptiste BRIAUD -- Novlog <j-...@novlog.com>.
I'm not sure but did you try to add transient keyword on your statif
number field ?
On Aug 3, 2009, at 15:24 , Udi wrote:
>
> Hey,
> I have this case:
>
> class Book{
> @id
> protected long id;
> private static number = 0;
>
> @prePersist
> private void makeSomeID(){
> id = ++number;
> }
> }
>
> class Persister{
> public static void main(...){
> while (true){
> em.persist(new Book());
> }
> }
> }
>
> I don't know why I sometimes get EntityExistsException.
> The openJPA documentation says nothing about this exception. Why do
> I get
> it?
>
> ps - I know it's not compiling, I just can't copy the code from the
> workspace...
>
> thanks
>
> Udi
> --
> View this message in context: http://n2.nabble.com/EntityExistsException-issue-tp3377645p3377645.html
> Sent from the OpenJPA Users mailing list archive at Nabble.com.
>
Re: EntityExistsException issue
Posted by Rick Curtis <cu...@gmail.com>.
Udi wrote:
>
> Hey,
> I have this case:
>
> class Book{
> @id
> protected long id;
> private static number = 0;
>
> @prePersist
> private void makeSomeID(){
> id = ++number;
> }
> }
>
> class Persister{
> public static void main(...){
> while (true){
> em.persist(new Book());
> }
> }
> }
>
> I don't know why I sometimes get EntityExistsException.
> The openJPA documentation says nothing about this exception. Why do I get
> it?
>
> ps - I know it's not compiling, I just can't copy the code from the
> workspace...
>
> thanks
>
> Udi
>
Are you cleaning your database out between each run?
-Rick
--
View this message in context: http://n2.nabble.com/EntityExistsException-issue-tp3377645p3393139.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.