What gets stored in an object object, and what doesn't?
"Aidan Slingsby" <[email protected]>
| Newsgroups | gmane.comp.java.ozone.user |
|---|---|
| Message-ID | <000101c43a8b$1963e9e0$3ed62880@Musa> |
Hello all, If an ozone object has a Vector, and things are added to it, I've always assumed that if they are Ozone objects, they are not stored again in the object, but a reference (or pointer) to the object in the database is stored instead. If it is not an ozone object (like a String) it would get stored. This has always held true, but now I'm getting some strange behaviour which has taken me quite a while to find out what's going on. I have a unnamed ozone class called FeatureImpl. I also have another unnamed ozone class called LineImpl. Many instances of both exist in the database. Feature has a Vector (actually is isn't, it's an object which extends Object and contains a Vector). I have a routine which adds LineImpls to this Vector. Within the same routine, if I list the last object in the vector of the FeatureImpl just after I've added it, the returned object has the same remoteID (hashCode) as the the object I just added. All well and good. The strange behaviour is here: When I disconnect from the database and reconnect, they the FeatureImpl Vector contains LineImpls (well.. proxies anyway) with a different and higher remoteID/hashCode - yet have the same state variables - which means that my overrided equals routine (which compares hashcodes) sees them as different. In looks to me like the database has duplicates these objects and that this somehow and for some reason happened after I read the last element in the Vector just after adding is and reading the contents of the Vector after disconnection and reconnection. The LineImpl may be stored in the Vector of FeatureImpl (hence my opening paragraph), but actually I think this isn't the case because it has a new remoteID I'm using Ozone 1.2 and LocalDatabase. This definitely worked before, but I can't be sure if it's to do with my changing from Ozone 1.1 and ExternalDatabase to Ozone 1.2 and LocalDatabase. (I changed to the latter because it's easier to debug in a LocalDatabase). Is anyone able to offer advice on my problem? Thanks, Aidan. ------------------------------------------------------- This SF.Net email is sponsored by: SourceForge.net Broadband Sign-up now for SourceForge Broadband and get the fastest 6.0/768 connection for only $19.95/mo for the first 3 months! http://ads.osdn.com/?ad_id=2562&alloc_id=6184&op=click