AW: [OJB-developers] Extent aware cache
Brought to you by:
thma
|
From: Mahler T. <tho...@it...> - 2001-10-12 06:50:01
|
Hi Michal,
please try to replace the constructor of ojb.broker.Identity with the
following code:
public Identity(Object objectToIdentitify)
{
try
{
DescriptorRepository repository =3D
DescriptorRepository.getInstance();
ClassDescriptor mif =3D
repository.getDescriptorFor(objectToIdentitify.getClass());
// identities are unique across extents, thus use extent =
class
for identification:
this.objectsClass =3D
repository.getExtentClass(objectToIdentitify.getClass());
this.pkValues =3D mif.getKeyValues(objectToIdentitify);
}
catch (ojb.broker.metadata.ClassNotPersistenceCapableException =
ex)
{
throw new
org.odmg.ClassNotPersistenceCapableException(ex.getMessage());
}
}
To make this work for your example you must declare an Extent for =
Interface
A, containing class AImpl in the OJB XML Repository.
An example for declaring an Interface based Extent can be found in the
sample repository.xml.
please let me know if this fixes your problem.
HTH, Thomas
> -----Urspr=FCngliche Nachricht-----
> Von: Michal Kleczek [mailto:mkl...@ya...]
> Gesendet: Dienstag, 9. Oktober 2001 09:17
> An: obj...@li...
> Betreff: [OJB-developers] Extent aware cache
>=20
>=20
> Hi,
> I just found a serious bug in my application
> and it looks like the problem lays in ObjectCacheDefaultImpl.
> Situation looks like this:
>=20
> interface A {
> ...
> }
>=20
> class AImpl implements A {
> ...
> }
>=20
> class B {
> A aReference;
> }
>=20
> class C {
> AImpl aImplReference; //points to the same instance as B.aReference
> }
>=20
> After reading objects B and C should be:
> B.aReference =3D=3D C.aImplReference.
>=20
> But it is not!!!
> The problem is that cache is not aware of extents so:
> cache(B.aReference) puts <"A{x}", B.aReference> into the hashtable =
and
> lookup(C.aImplReference) looks for "AImpl{x}" and returns null.
>=20
> Regards,
> Michal
>=20
>=20
> _________________________________________________________
> Do You Yahoo!?
> Get your free @yahoo.com address at http://mail.yahoo.com
>=20
>=20
> _______________________________________________
> Objectbridge-developers mailing list
> Obj...@li...
> https://lists.sourceforge.net/lists/listinfo/objectbridge-developers
>=20
|