Hi again,

Christophe.Demarey wrote:
Hi all,

if the String argument is the result of As I said in my last mail, the PersistenceManager.newObjectIdInstance(Class pcClass, String str) failed executing toString on an object id instance.
With OJB,
newObjectIdInstance(Class pcClass, Identity.toString()) does not work!
We got a "java.io.IOException: Not in GZIP format".
We must use newObjectIdInstance(Class pcClass, Identity.serialize()).


But this method does not appear in the JDO specification :=(.

But o.a.ojb.broker.Identity itself does also not appear in the JDO spec! Handling of Identity objects is left to the JDO implementor.

My argument here is that the JDO spec does not contain an Identity object. It does also not contain any formal contract between Identity objects and the PersistencecManager.

So using Identity.serialize() is not against the JDO.

So, if one want to use ObjectId with JDO, its software application is dependant on OJB and can't be used with another OJB implementation.

It becomes dependend by using OJB Identity objects already! Different JDO implementations will use diffent Identity concepts!


I think it could be usefull to rename the Identity.toString() method and
to implement a new Identity.toString() method :

public String toString()
{
    return new String( serialize() );
}

In this case, OJB will become JDO compliant with ObjectId.
I don't know if the actual Identity.toString() method is often used but I think rename this method will not change a big part of OJB. Am I wrong?

Identity.toString() is used to produce a human readable representation of an Identity. It is used in this way in several places.
So IMO it's not an option to change the semantics of toString().


The "real" solution could be to provide a Parser that can build Indentities from the Identity.toSTring() representation.
But that's a lot of work and the benefit is rather small, as using serialize() is not a violation of the JDO spec IMO.


cheers,
Thomas



Best Regards.


PS: Thanks to Thomas Mahler for its explanation.



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to