You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by John Meredith <ps...@t-online.de> on 2003/11/05 17:03:15 UTC

RE: [Fwd: Re: OJB, Tapestry, Serialized Objects and a questforanswers.]

Thanks for the explanation Tsvetelin, cleared things up :-)

Rgds,

  - John

On Wed, 2003-11-05 at 16:55, tsvetelin wrote:
> Hi John,
> 
> You don't need to encode the class name in your JDO squeezer because this is
> handled by JDO implementations.
> Here are 2 cases that are possible.
> 
> The first one is when the JDO implementation define your JDO identity class.
> In this case the JDO implementation use its identity class. This class
> contains the primary keys for your object (in the most cases it is a int or
> long value) and the class name of corresponded data object. When you take
> the string presentation of the identity instance it encode class name. So
> the JDO implementation know persistence class name for each instance of
> identity object. For example I am using the Kodo JDO and their identity
> class is: com.solarmetric.kodo.util.ObjectIds$Id. It contains 2 properties.
> long and persistence class
> 
> The second case is when you define the identity class for particular
> persistent class in package.jdo file. For more information please see the
> JDO metadata(<!ATTLIST class identity-type (application|datastore|none)
> 'datastore'> and <!ATTLIST class objectid-class CDATA #IMPLIED> ). In this
> case the JDO implementation know which is associated persistent class for
> particular identity object.
> 
> 
> I hope that this will be useful.
> 
> Tsvetelin
> 
> -----Original Message-----
> From: John Meredith [mailto:psynix@t-online.de]
> Sent: Wednesday, November 05, 2003 4:48 PM
> To: Tapestry users
> Subject: Re: [Fwd: Re: OJB, Tapestry, Serialized Objects and a
> questforanswers.]
> 
> 
> Possibly a stupid question (and somewhat OT), do you have an Adaptor for
> each JDO and if not, how do you get from the oid back to the object
> without distinguishing between your ModelObjects? Or does JDO encode
> this into the oid?
> 
> I generally use integer sequences for my iod (provided by the DB), which
> is why I've had to encode the classname as well.
> 
> Just interested in how other people are doing this :-)
> 
>   - John
> 
> On Wed, 2003-11-05 at 12:23, Ryan Moffat wrote:
> > Yeah that's pretty much how the JDO squeezer is written.  My only change
> is
> > that my persitance capable classes all implement a common interface
> (always
> > found this usefull) defining a getId() method which I use in the Squeezer.
> >
> >     /**
> >      *  Squeezes the {@link is.symbian.framework.model.ModelObject} data
> to
> > it's oid string
> >      */
> >     public String squeeze(DataSqueezer squeezer, Object data) {
> >         is.symbian.framework.model.ModelObject jdoObject =
> > (is.symbian.framework.model.ModelObject) data;
> >         return PREFIX + jdoObject.getObjectId().toString();
> >     }
> >
> >     /**
> >      * Un-squeezes a jdo object using it's oid string to locate it.
> >      */
> >     public Object unsqueeze(DataSqueezer squeezer, String string) {
> >         PersistenceManager pm = JDOSupport.getPM();
> >         if (string.length() == PREFIX.length()) return "";   // Probably a
> > problem
> >         Object o = pm.newObjectIdInstance(null,
> > string.substring(PREFIX.length()));
> >         return pm.getObjectById(o, true);
> >     }
> >
> > Cheers
> > Ryan Moffat
> >
> > ----- Original Message -----
> > From: "John Meredith" <ps...@t-online.de>
> > To: "Tapestry users" <ta...@jakarta.apache.org>
> > Sent: Wednesday, November 05, 2003 10:29 AM
> > Subject: Re: [Fwd: Re: OJB, Tapestry, Serialized Objects and a quest
> > foranswers.]
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
> --
> John Meredith <ps...@t-online.de>
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
-- 
John Meredith <ps...@t-online.de>