Hi Christophe,

The OjbStoreManager implements newObjectIdInstance as follows:

    public Object newObjectIdInstance(Class pcClass, String str)
    {
        return Identity.fromByteArray(str.getBytes());
    }

The input this method expects is a String generated by a call to
Identity.serialize()

Identity.toString() does not work!

cheers,
Thomas

> Hi,
> 
> In the JDO specification, we can find :
> public java.lang.Object newObjectIdInstance(java.lang.Class pcClass,
>                                              java.lang.String str)
> 
> This method returns an object id instance corresponding to 
> the Class and 
> String arguments. The String argument might have been the result of 
> executing toString on an object id instance.
> 
> Parameters:
> pcClass - the Class of the persistence-capable instance
> str - the String form of the object id
> Returns:
> an instance of the object identity class
> 
> 
> I stored the String form of an object id and then tried to rebuild an 
> object id with the method  "newObjectIdInstance" on the 
> Persistance Manager.
> But it seems OJB doesn't support this feature. I get the following 
> exception.
> Any idea about it ?
> 
> Thanks.
> 
> ------------------------
> java.io.IOException: Not in GZIP format
>          at 
> java.util.zip.GZIPInputStream.readHeader(GZIPInputStream.java:129)
>          at 
> java.util.zip.GZIPInputStream.<init>(GZIPInputStream.java:57)
>          at 
> java.util.zip.GZIPInputStream.<init>(GZIPInputStream.java:67)
>          at 
> org.apache.ojb.broker.Identity.fromByteArray(Unknown Source)
>          at 
> org.apache.ojb.jdori.sql.OjbStoreManager.newObjectIdInstance(U
> nknown Source)
>          at 
> com.sun.jdori.common.PersistenceManagerImpl.newObjectIdInstanc
> e(Unknown 
> Source)
>          at 
> com.sun.jdori.common.PersistenceManagerWrapper.newObjectIdInst
> ance(Unknown 
> Source)
>          at ...
> rethrown as org.apache.ojb.broker.PersistenceBrokerException: Not in 
> GZIP format
>          at 
> org.apache.ojb.broker.Identity.fromByteArray(Unknown Source)
>          at 
> org.apache.ojb.jdori.sql.OjbStoreManager.newObjectIdInstance(U
> nknown Source)
>          at 
> com.sun.jdori.common.PersistenceManagerImpl.newObjectIdInstanc
> e(Unknown 
> Source)
>          at 
> com.sun.jdori.common.PersistenceManagerWrapper.newObjectIdInst
> ance(Unknown 
> Source)
>          at ...
> Caused by: java.io.IOException: Not in GZIP format
>          at 
> java.util.zip.GZIPInputStream.readHeader(GZIPInputStream.java:129)
>          at 
> java.util.zip.GZIPInputStream.<init>(GZIPInputStream.java:57)
>          at 
> java.util.zip.GZIPInputStream.<init>(GZIPInputStream.java:67)
>          ... 18 more
> 
> 
> -- 
> Christophe Demarey,
> Research engineer
> OpenCCM project - http://www.objectweb.org/openccm
> GOAL Team - CNRS/USTL/LIFL - http://www.lifl.fr/GOAL/
> Universite des Sciences et Technologies de Lille
> LIFL - UMR CNRS 8022- Batiment M3
> 59655 Villeneuve d'Ascq Cedex - FRANCE
> Phone: +33 (0)32043 4728
> Fax  : +33 (0)32043 6566
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 


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

Reply via email to