cayenne-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michael Gentry <blackn...@gmail.com>
Subject Re: URI for data object?
Date Tue, 12 Dec 2017 19:24:51 GMT
Hi Ken,

I had some code somewhere that did this, but can't find it offhand.

Nutshell version, I was storing the information in this format:

EntityName:KeyName:KeyValue

You can get that information from the Cayenne[1] (or DataObjectUtils if on
3.0) helper class.  That format requires a single PK and likewise a single
integer PK value.

When I needed the object back, I split on the colons and used the parts to
construct a new ObjectId(entityName, key, value) and passed that to
Cayenne.objectForPK(context, objectId).

mrg

[1] http://cayenne.apache.org/docs/3.1/api/org/apache/cayenne/Cayenne.html



On Tue, Dec 12, 2017 at 1:44 PM, Ken Anderson <ken.anderson@amphorainc.com>
wrote:

> Everyone,
>
> I’ve been looking around the Cayenne API, but have not been able to find a
> way to serialize an object ID into a string, and then turn that string back
> into an object ID or object.  What’s the best/right way to do this?  For
> instance, if you want to store a reference to a database object in a text
> file…
>
> Thanks,
> Ken
> Confidentiality Notice: This e-mail and accompanying documents contain
> confidential information intended for a specific individual and purpose.
> This e-mailed information is private and protected by law. If you are not
> the intended recipient, you are hereby notified that any disclosure,
> copying, or distribution, or the taking of any action based on the contents
> of this information, is strictly prohibited.
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message