🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.jbuilder.java.language
Article #16287

JGL (Map Classes) problem

#16287
From: Nick Collier
Date: Tue, 16 Mar 1999 00:00
38 lines
2100 bytes
Hi,

I'm having a problem with an OrderedMap (although the same problem occurs
with a HashMap as well) from Objectspace's JGL. I'm using it as part of a
persistent library such that tables of "objects" can be restored from a
relational database into a persistent set. The actual container in this
persistent set class is an OrderedMap.

The problem is that although 1583 objects are read from the database only
423 are actually stored in the OrderedMap. I've done some extensive checking
and what appears to happen is that when certain objects are put into the
map, they overwrite previously put objects. What is particularly odd here is
that this occurs even when the Map is initialized to allow duplicates.
Moreover, putting the identical objects into a java.util.Hashtable results
in all 1583 objects being put correctly.

I'm using the persistent objects primary key as the key when putting the
object. This key is a com.objectspace.jgl.Pair - and so hashcode, and equals
are overridden appropriately. The object itself also overrides hashcode and
equals so that objects with identical primary keys are treated as identical
objects.

This has stymied me for a day or two now - I checked the entire persistent
library figuring the problem was there and not with the Map classes. I need
to use jgl's iterators to iterate backwards and forwards through these Maps,
so switching to an old style Hashtable is really not an option, although the
new Collection classes may be okay.

thanks,

Nick

--
Nick Collier
nick@spc.uchicago.edu
Database Developer
Social Science Research Computing
University of Chicago
Technical Details
Message-ID: <7clte8$4dq7@forums.borland.com>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f74b3,ab05c2053b6e22d1,start
X-Google-Attributes: gidf74b3,public
From: "Nick Collier" <nick@spc.uchicago.edu>
Subject: JGL (Map Classes) problem
Date: 1999/03/16
Message-ID: <7clte8$4dq7@forums.borland.com>
X-Deja-AN: 455650613
Organization: Another Netscape Collabra Server User
X-MimeOLE: Produced By Microsoft MimeOLE V4.72.3110.3
Newsgroups: borland.public.jbuilder.java.language