I wondered this also.  The only reason I can come up with is it verifies
that the Primary Key exists in the table.  If you skip it, you are never
able to check whether the object actually exists or not.  However, if
you have just queried these items from the DB, perhaps this check is
unnecessary.

Bryan Field-Elliot wrote:
> 
> This question is one of optimization and improving performance:
> 
> I need to create an array of entity bean references. I already have an array
> of primary keys, which I get from a direct JDBC query. I need to convert
> these primary keys into entity bean references. The "obvious" way to do this
> is to iterate through the array and call "findByPrimaryKey" for each of
> these references. However, this results in what appears to be a wasteful
> query, for every call to findByPrimary Key:
> 
> select id from my_table where id = ?
> 
> This is useless, and yet it gets called with every call to findByPrimaryKey.
> The rest of the columns are only pulled in when the client actually calls
> one of the get() methods on my beans:
> 
> select col1, col2, col3, ... from my_table where id = ?
> 
> So you see, I'd like to skip the calling of the first query altogether. Is
> there a way I can do this with JOnAS?
> 
> By the way, these are CMP entity beans. I suspect I can get the behavior I
> want with BMP, but I would like to stay CMP if at all possible (saves a lot
> of work).
> 
> Thank you,
> Bryan
> 
> ----
> To unsubscribe, send email to [EMAIL PROTECTED] and
> include in the body of the message "unsubscribe jonas-users".
> For general help, send email to [EMAIL PROTECTED] and
> include in the body of the message "help".

-- 
Conan C. Albrecht
Director of Software Development
Center for the Management of Information
University of Arizona
McClelland Hall Room 114
Tucson, AZ  85721
http://www.cmi.arizona.edu/users/calbrecht/
[EMAIL PROTECTED]
 -- or --
[EMAIL PROTECTED]
(520) 621-2640 (voice)
(520) 991-0644 (cell)
(520) 621-2641 (fax)
----
To unsubscribe, send email to [EMAIL PROTECTED] and
include in the body of the message "unsubscribe jonas-users".
For general help, send email to [EMAIL PROTECTED] and
include in the body of the message "help".

Reply via email to