dcsimg
Why findByxxx method returns Collections instead of array?
2 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   ashok_chindam
Posted On:   Thursday, September 27, 2001 10:40 PM

Why findByxxx method is returning Enumeration or Collection (depending on version) instead of array of EB interfaces or primaryKeys.

I read that arrays are lighter than these collections and should prefer them.


Thanks in advance..


Ashok.

Re: Why findByxxx method returns Collections instead of array?

Posted By:   Shai_Almog  
Posted On:   Saturday, September 29, 2001 05:47 AM

Lazy instanciation, when you get a collection/enumeation its probable that all the server really did was retrieve the primary keys. This allows the server a great deal of control.

Re: Why findByxxx method returns Collections instead of array?

Posted By:   Bozidar_Dangubic  
Posted On:   Friday, September 28, 2001 04:48 AM

what if Sun decided to re-design how EJBs work in version 3.0 and figured out a way for clients of the EJB to not have to worry about primary keys. What kind of array is it going to return then? will this be compatible with the previous version? definitely not. to answer questions like you posted, you have to think outside the box as they think when they come up with the specifications. you can also get involved in java community process and participate if you think your solutions to issues Sun is facing are more reasonable then what is currently offered. can you think of another reason why your solution is a bad idea (other then the one I outlined above)?
About | Sitemap | Contact