users@jersey.java.net

Re: [Jersey] synchronized

From: Felipe Gaúcho <fgaucho_at_gmail.com>
Date: Tue, 19 May 2009 22:53:32 +0200

ok.. I know I can do some tricks with proprietary functions in
databases.. and now I am looking for something more portable in JPA..

if nothing else helps, than I will start to create the old fashion
"one-script-per-database" :)

my JPA code:

        @Id
        @GeneratedValue(strategy = GenerationType.AUTO)
        private int id;

then I supposed JPA/Toplink would guarantee uniqueness :(


On Tue, May 19, 2009 at 10:41 PM, Tatu Saloranta <tsaloranta_at_gmail.com> wrote:
> 2009/5/19 Felipe Gaúcho <fgaucho_at_gmail.com>:
>
>> Jersey is not synchronized, right ?
>
> Others have already answered wrt synchronization part, but regarding this:
>
> ...
>> Internal Exception:
>> com.mysql.jdbc.exceptions.MySQLIntegrityConstraintViolationException:
>> Duplicate entry '455' for key 1
>> Error Code: 1062
>> Call: INSERT INTO FPCERTIFICATE (ID, PATH, VERSION, USER_ID) VALUES
>> (?, ?, ?, ?) bind => [455, /docs/453/8/cert, 1, 453]
>
> This very likely has nothing to do with java level synchronization.
>
> It rather sounds like id column is not defined to use the usual mysql
> idiom (auto_increment for 'id' colun), which would guarantee
> uniqueness of the key.
>
> Hope this helps,
>
> -+ Tatu +-
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
> For additional commands, e-mail: users-help_at_jersey.dev.java.net
>
>



-- 
Please help to test this application:
http://fgaucho.dyndns.org:8080/cejug-classifieds-richfaces