users@glassfish.java.net

Re: RE: persistence: ommiting sequence for ID?

From: <glassfish_at_javadesktop.org>
Date: Thu, 24 May 2007 15:17:20 PDT

So. there is a insert into contacts table ( because it's conneceted with users ) and then there goes something like

"
_ThreadID=18;_ThreadName=httpWorkerThread-8081-0;ClassName=null;MethodName=null;InsertObjectQuery(persistence.User[userId=444]);_RequestID=db6a2c09-0a54-4db8-b300-8651a634e1b3;
Record Number:
        
416
Message ID:
        
Complete Message

execute_query
"
so - there is userId = 444 (my test id )

then

        
INSERT INTO users (customId, change_stamp, surname, delete_stamp, name, office_id, contact_id, role_id) VALUES (?, ?, ?, ?, ?, ?, ?, ?) bind => [A1180044348125,
2007-05-25 00:05:48.125, asdasd, 2007-05-25 00:05:48.125, asdasd, null, 42, 4]


which shows, that the ID is omited, so - database is giving its own value.

and finally

select currval('users_user_id_seq')

And then it gives insert on accounts table, which have reference to users.id = 57 ( assigned from database)

anyway - I don't know why it goes like that.
It's not THIS important to me. I found an alternative solution to my problem, I'm giving the customId, but it's not perfect.

If You still have some ideas - please ask :)
[Message sent by forum member 'kretes' (kretes)]

http://forums.java.net/jive/thread.jspa?messageID=218829