[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Limitation of Ozone -- Cant return an iterator



On Sat, 02 Dec 2000, Neil Aggarwal wrote:
> Falko:
> 
> Thanks for the help.  But, this leads me to another question:
> 
> What is the best way to return a collection of objects 
> from the database?
> 
> For example, if I want to retrieve all objects with a given
> attribute value.
> 
> Is it best to declare my own collection class that has
> a proxy and then fill that collection and return the proxy
> object for the collection.
> 
> It seems like then Ozone should have a library of collection
> classes for operations like this.
> 
> They could really be wrappers around the Java collection
> classes.

Returning a java2 collection that holds database objects (actually their
proxies) is, in contrast to your approach to return the iterator for it, no
problem.

For example: if your database object holds all employees, which inturn are
database objects, in a java2 collection, then it may select some of them, put
them in a new collection and return it to the caller. Whether this caller is the
client or another database objects doesn't make a difference.


Falko

> 
> Thanks,
> 	Neil.
> 
> 
> > In your code you are trying to manipulate the internal data of an database
> > object via ordinary Java references. The hashmap iterator keeps a ordinary
> > java reference to the hashmap to do its job. It knows nothing about ozone's
> > persistent references (proxies). After the iterator is serialized thru the
> > socket connection its references are no longer valid in the new VM.
> > 
> > Besides, java.util.HashMap$HashIterator is plain and simple not serializable.
> > One could hardly tell this a limitation of ozone.
> 
> --
> Neil Aggarwal
> JAMM Consulting, Inc. -- (972) 612-6056, http://www.JAMMConsulting.com
> Custom Internet Development -- Java, JSP, servlets, databases
-- 
______________________________________________________________________
Falko Braeutigam                              mailto:falko@smb-tec.com
SMB GmbH                                        http://www.smb-tec.com