You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ojb-user@db.apache.org by Muhammad Aamir <mu...@kictl.com> on 2004/03/03 11:07:42 UTC

Mapping Inheritance

How can we implement inheritance with one table for each class and
tables are joined with foreign key (no duplicating columns)
 
Thank you,
 
Muhammad Aamir
Senior Software Engineer
Karachi International Container Terminal
Tel:  (9221) 2316401-20 
Fax: (9221) 2313816 
E-mail: muhammad_aamir@kictl.com 
Website: http://www.kictl.com
 

RE: OJB and JCS

Posted by Guillaume Nodet <gu...@deliasystems.com>.
After having read to serveral informations about jcs, i found it is 
preferred to use strings instead of objects for cached object keys.
As it seems that the string representation of Identity objects is
unique, it should seems better than the jcs cache implementation
uses these strings instead of Identity objects.

Cheers,

Guillaume

-----Message d'origine-----
De : Guillaume Nodet [mailto:guillaume.nodet@deliasystems.com]
Envoye : mercredi 31 mars 2004 09:23
A : OJB
Objet : OJB and JCS



Hi !

I'm trying to use JCS for the cache layer in 
OJB and encountered the following problem:
the hash code of the Identity object is computed 
using the hash code of the top-level class
of the real subject. The problem is that the
hashCode() method  of the Class object is not
overrident so that it depends on the internal
state of the jvm and is not the same across
different jvms.  So when serializing the Identity
object to send to JCS, the hashCode is serialized
along with the object (it is part of it for performance
reasons) and the cache is messed up, because another
jvm could have computed another hash code for the same
object.

Could the m_stringRepresentation and the m_hashCode 
attributes of the Identity class could be made transient,
so that they are not serialized with the Identity ?

Thanks,

Guillaume Nodet

---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org


Re: [bug] Identity class [was OJB and JCS]

Posted by Armin Waibel <ar...@apache.org>.
Hi Guillaume,

Guillaume Nodet wrote:
> The Identity class caches internally the hash code 
> and the string representation in private attributes.
> These attributes are not declared transient, thus
> the computed hash code is serialized. The problem is
> that the Class.hashCode() method not overriden
> and so relies on the Object.hashCode() method which
> is not guaranteed to give the same values when
> serialized/deserialized.
> 
> Could these attributes be made transient ?
> 

Agree with you, the Class (Object) hashCode method will not be the same
in different JVM.
We can
- declare both fields as transient
- use the class name instead the class object

First one is the safest way to go, but hashcode/toString has to be 
re-calculated after each serialization. Second one is not safe when 
using different JVM implementations (hashCode calculation of the class 
name can differ in different JVM implementations).
So I prefer your suggestion.

regards,
Armin

> Thanks,
> Guillaume
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
> For additional commands, e-mail: ojb-user-help@db.apache.org
> 
> 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org


[bug] Identity class [was OJB and JCS]

Posted by Guillaume Nodet <gu...@deliasystems.com>.
The Identity class caches internally the hash code 
and the string representation in private attributes.
These attributes are not declared transient, thus
the computed hash code is serialized. The problem is
that the Class.hashCode() method not overriden
and so relies on the Object.hashCode() method which
is not guaranteed to give the same values when
serialized/deserialized.

Could these attributes be made transient ?

Thanks,
Guillaume


---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org


OJB and JCS

Posted by Guillaume Nodet <gu...@deliasystems.com>.
Hi !

I'm trying to use JCS for the cache layer in 
OJB and encountered the following problem:
the hash code of the Identity object is computed 
using the hash code of the top-level class
of the real subject. The problem is that the
hashCode() method  of the Class object is not
overrident so that it depends on the internal
state of the jvm and is not the same across
different jvms.  So when serializing the Identity
object to send to JCS, the hashCode is serialized
along with the object (it is part of it for performance
reasons) and the cache is messed up, because another
jvm could have computed another hash code for the same
object.

Could the m_stringRepresentation and the m_hashCode 
attributes of the Identity class could be made transient,
so that they are not serialized with the Identity ?

Thanks,

Guillaume Nodet

---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org


OJB and JCS

Posted by Guillaume Nodet <gu...@deliasystems.com>.
Hi !

I'm trying to use JCS for the cache layer in 
OJB and encountered the following problem:
the hash code of the Identity object is computed 
using the hash code of the top-level class
of the real subject. The problem is that the
hashCode() method  of the Class object is not
overrident so that it depends on the internal
state of the jvm and is not the same across
different jvms.  So when serializing the Identity
object to send to JCS, the hashCode is serialized
along with the object (it is part of it for performance
reasons) and the cache is messed up, because another
jvm could have computed another hash code for the same
object.

Could the m_stringRepresentation and the m_hashCode 
attributes of the Identity class could be made transient,
so that they are not serialized with the Identity ?

Thanks,

Guillaume Nodet

---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org