You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ojb-user@db.apache.org by Mike Jackson <mj...@cdi-hq.com> on 2004/05/29 01:11:36 UTC
Test ignore
Prior messages not coming back so I'm testing, please ignore this.
--mikej
-=-----
mike jackson
mjackson@cdi-hq.com
---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org
Re: Test ignore
Posted by Eddie Yan <ed...@streamyx.com>.
I haven't use SequenceManagerNextValImpl Sequence Manager before,
but based on the manual, Attribute autoNaming default was 'true'.
If set 'true' OJB try to build a sequence name automatic if none found in
field-descriptor
and set this generated name as sequence-name in field-descriptor.
You shouldn't set the userId from your value object, i.e:
user.setUserId( new Integer( 0 ) ). If you leave out that part alone,
OJB will smart enough to create an auto increment primary key, providing you
set it correctly in the repository_user.xml. When you retrieve the User
object,
you can see the newly created primary key.
Ed.
----- Original Message -----
From: "Mike Jackson" <mj...@cdi-hq.com>
To: "'OJB Users List'" <oj...@db.apache.org>
Sent: Saturday, May 29, 2004 7:32 AM
Subject: RE: Test ignore
> I'm getting a strange behavior with OJB. I'm running RC5 and I have a
table
> with an artificial primary key (OJB handles the generation of the key and
> uses a SequenceManagerNextValImpl to do so). I'm doing something like
this:
>
> User user = new User();
> user.setUserId( new Integer( 0 ) );
> QueryByCriteria query = new QueryByCriteria( user );
> user = ( User ) broker.getObjectByQuery(query);
>
> Where "User" is the object which maps to the user table configured in OJB.
> I don't get any errors or anything and the object comes back fully
> populated. But the user id changes. Generally on the first run I get
back
> user id = 0. On the second run it's user id = 1, then 2, then 3, etc.
For
> the life of me I can't figure out what's going on. I had thought that
> perhaps it was picking up the next value from the sequence, but when I
> restart the application it resets back to 0 and then increments from
there.
> I'm going to try updating to RC6, but does anyone have any ideas
otherwise?
>
> --mikej
> -=-----
> mike jackson
> mjackson@cdi-hq.com
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
> For additional commands, e-mail: ojb-user-help@db.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org
RE: Test ignore
Posted by Mike Jackson <mj...@cdi-hq.com>.
I'm getting a strange behavior with OJB. I'm running RC5 and I have a table
with an artificial primary key (OJB handles the generation of the key and
uses a SequenceManagerNextValImpl to do so). I'm doing something like this:
User user = new User();
user.setUserId( new Integer( 0 ) );
QueryByCriteria query = new QueryByCriteria( user );
user = ( User ) broker.getObjectByQuery(query);
Where "User" is the object which maps to the user table configured in OJB.
I don't get any errors or anything and the object comes back fully
populated. But the user id changes. Generally on the first run I get back
user id = 0. On the second run it's user id = 1, then 2, then 3, etc. For
the life of me I can't figure out what's going on. I had thought that
perhaps it was picking up the next value from the sequence, but when I
restart the application it resets back to 0 and then increments from there.
I'm going to try updating to RC6, but does anyone have any ideas otherwise?
--mikej
-=-----
mike jackson
mjackson@cdi-hq.com
---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org