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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to