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 Edson Carlos Ericksson Richter <ed...@mgrinformatica.com.br> on 2003/03/21 18:38:18 UTC

ODMG Query over objects always returns a Collection (DList)?

Hi!

Table:
  UsersTable (id, username, password) -> mapped to User object with same
properties.
where id is Primary Key, and username is a unique key.

Well, if I query "select user from User where username = $1 and password =
$2", ODMG will always return a collection when I issue query.execute()? Or
it should detect that has only one object, and return a User object?

Just get from API doc for OQLQuery:
"The object that represents the result of the query. The returned data,
whatever its OQL type, is encapsulated into an object. For instance, when
OQL returns an integer, the result is put into an Integer object. When OQL
returns a collection (literal or object), the result is always a Java
collection object of the same kind (for instance, a DList). "

Appear to me that when OQL returns an User, the result should be put into
User object, as in "For instance, when OQL returns an integer, the result is
put into an Integer object".


Thanks for any clarification.

Edson Richter



---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.463 / Virus Database: 262 - Release Date: 17/3/2003

Re: auto_increment problem?

Posted by Armin Waibel <ar...@code-au-lait.de>.
Hi Chuck,

Could you post a little more info.
Which OJB version?
Which sequence manager implementation do you use, or
post your repository_database.xml file (if you use one).

regards,
Armin

----- Original Message -----
From: "Chuck Grohowski" <ch...@hubcitymedia.com>
To: "OJB Users List" <oj...@db.apache.org>
Sent: Monday, March 24, 2003 4:09 PM
Subject: auto_increment problem?


> I noticed a strange anomaly when using OJB with auto_increment fields
in
> MySQL.  After doing a few inserts of new objects, the auto_increment
field
> has values in the hundreds.  Is this behavior normal or is there
something
> going awry?
>
> Any help is appreciated.  Thanks!
>
> Chuck
>
> --------------------------
> Hub City Media, Inc.
> www.hubcitymedia.com
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
> For additional commands, e-mail: ojb-user-help@db.apache.org
>
>
>


auto_increment problem?

Posted by Chuck Grohowski <ch...@hubcitymedia.com>.
I noticed a strange anomaly when using OJB with auto_increment fields in
MySQL.  After doing a few inserts of new objects, the auto_increment field
has values in the hundreds.  Is this behavior normal or is there something
going awry?

Any help is appreciated.  Thanks!

Chuck

--------------------------
Hub City Media, Inc.
www.hubcitymedia.com



mass inserts

Posted by Yuji Shinozaki <ys...@virginia.edu>.
When we do a lot of inserts at once, it seems like OJB does a lot of
"pre-querying".   I think this is for deciding whether a new object
consistutes an UPDATE or an INSERT.   For mass-loading of objects
(which we know will be new unique INSERTS). Is there anything we could do
to optimize the process?  Prevent it from pre-querying?

Will proxies help by quickening the queries?

Any pointers welcome.

yuji
----
Yuji Shinozaki	                        Computer Systems Senior Engineer
ys2n@virginia.edu			Advanced Technologies Group
(804)924-7171				Information Technology & Communication
http://www.people.virginia.edu/~ys2n    University of Virginia


Re: ODMG Query over objects always returns a Collection (DList)?

Posted by "Robert S. Sfeir" <sf...@mail.nih.gov>.
I should add that a DList or Collection of some type is returned is 
actually a good thing.  Why?  Take a scenario where you have a User 
object and we're returning a User object from OJB.  You use that object 
all over your code.  One day you decide to change the User object and 
call is People.  You code will be broken from top to bottom because it 
either won't find your object or you'll get ClassCastException s.  If 
we always return a Collection then you always deal with a Collection 
and what is inside it is irrelevant until you get to the point in your 
code where you need to retrieve that object.  In my case that doesn't 
happen until I get to the Presentation layer of my application which 
means I would effectively only break one spot if I changed anything, 
and that spot is predictable.

Just my 2c

On Monday, March 24, 2003, at 07:11 AM, Robert S. Sfeir wrote:

> The Collection (DList which is changeable from the OJB.properties) 
> DOES contain a User object.
>
>
> On Friday, March 21, 2003, at 12:38 PM, Edson Carlos Ericksson Richter 
> wrote:
>
>> Hi!
>>
>> Table:
>>   UsersTable (id, username, password) -> mapped to User object with 
>> same
>> properties.
>> where id is Primary Key, and username is a unique key.
>>
>> Well, if I query "select user from User where username = $1 and 
>> password =
>> $2", ODMG will always return a collection when I issue 
>> query.execute()? Or
>> it should detect that has only one object, and return a User object?
>>
>> Just get from API doc for OQLQuery:
>> "The object that represents the result of the query. The returned 
>> data,
>> whatever its OQL type, is encapsulated into an object. For instance, 
>> when
>> OQL returns an integer, the result is put into an Integer object. 
>> When OQL
>> returns a collection (literal or object), the result is always a Java
>> collection object of the same kind (for instance, a DList). "
>>
>> Appear to me that when OQL returns an User, the result should be put 
>> into
>> User object, as in "For instance, when OQL returns an integer, the 
>> result is
>> put into an Integer object".
>>
>>
>> Thanks for any clarification.
>>
>> Edson Richter
>>
>>
>>
>> ---
>> Outgoing mail is certified Virus Free.
>> Checked by AVG anti-virus system (http://www.grisoft.com).
>> Version: 6.0.463 / Virus Database: 262 - Release Date: 17/3/2003
>> <smime.p7s>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
> For additional commands, e-mail: ojb-user-help@db.apache.org


Re: ODMG Query over objects always returns a Collection (DList)?

Posted by "Robert S. Sfeir" <sf...@mail.nih.gov>.
The Collection (DList which is changeable from the OJB.properties) DOES 
contain a User object.


On Friday, March 21, 2003, at 12:38 PM, Edson Carlos Ericksson Richter 
wrote:

> Hi!
>
> Table:
>   UsersTable (id, username, password) -> mapped to User object with 
> same
> properties.
> where id is Primary Key, and username is a unique key.
>
> Well, if I query "select user from User where username = $1 and 
> password =
> $2", ODMG will always return a collection when I issue 
> query.execute()? Or
> it should detect that has only one object, and return a User object?
>
> Just get from API doc for OQLQuery:
> "The object that represents the result of the query. The returned data,
> whatever its OQL type, is encapsulated into an object. For instance, 
> when
> OQL returns an integer, the result is put into an Integer object. When 
> OQL
> returns a collection (literal or object), the result is always a Java
> collection object of the same kind (for instance, a DList). "
>
> Appear to me that when OQL returns an User, the result should be put 
> into
> User object, as in "For instance, when OQL returns an integer, the 
> result is
> put into an Integer object".
>
>
> Thanks for any clarification.
>
> Edson Richter
>
>
>
> ---
> Outgoing mail is certified Virus Free.
> Checked by AVG anti-virus system (http://www.grisoft.com).
> Version: 6.0.463 / Virus Database: 262 - Release Date: 17/3/2003
> <smime.p7s>