You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@cayenne.apache.org by ap...@lindesay.co.nz on 2006/06/29 14:58:18 UTC

writeNestedProperty

Hello;

Can I ask if there's something like 'takeValueForKeyPath(...)' from  
KVC that can be used with 'DataObject'?  I was looking for a  
'writeNestedProperty', but couldn't see it.

Regards;

___
Andrew Lindesay
www.lindesay.co.nz




Re: how to unsubscribe

Posted by Cypher ! <cy...@hotmail.com>.
thanks - just moving to gmail


From: Andrus Adamchik <an...@objectstyle.org>
Reply-To: cayenne-user@incubator.apache.org
To: cayenne-user@incubator.apache.org
Subject: Re: how to unsubscribe
Date: Fri, 30 Jun 2006 13:15:03 +0100

Sure. Send an email to cayenne-user-unsubscribe@incubator.apache.org  using 
"From" address that you used to subscribe. And then reply to  the 
confirmation email.

http://objectstyle.org/cayenne/lists.html

Let me know if you are still having problems.

Andrus


On Jun 30, 2006, at 12:57 PM, Cypher ! wrote:

>Does anyone know hot to unsubscribe from this list? Thanks
>

_________________________________________________________________
Be the first to hear what's new at MSN - sign up to our free newsletters! 
http://www.msn.co.uk/newsletters


Re: how to unsubscribe

Posted by Andrus Adamchik <an...@objectstyle.org>.
Sure. Send an email to cayenne-user-unsubscribe@incubator.apache.org  
using "From" address that you used to subscribe. And then reply to  
the confirmation email.

http://objectstyle.org/cayenne/lists.html

Let me know if you are still having problems.

Andrus


On Jun 30, 2006, at 12:57 PM, Cypher ! wrote:

> Does anyone know hot to unsubscribe from this list? Thanks
>

how to unsubscribe

Posted by Cypher ! <cy...@hotmail.com>.
Does anyone know hot to unsubscribe from this list? Thanks

_________________________________________________________________
Windows LiveĀ™ Messenger has arrived. Click here to download it for free! 
http://imagine-msn.com/messenger/launch80/?locale=en-gb


Re: writeNestedProperty

Posted by Andrus Adamchik <an...@objectstyle.org>.
Cayenne 3.0 will likely be supporting both kinds of persistent  
objects throughout the stack - those that implement DataObject (i.e.  
provide generic access to properties) and POJO's (or at least objects  
implementing Persistent interface) that doesn't have [read|write] 
(Nested)?Property. So the users will have a choice.

In this context adding writeNestedProperty makes sense for the first  
category.

Regarding nulls - Cayenne is like EOF in this respect - if a null is  
encountered in the path, null is immediately returned from the method.

Andrus


On Jun 30, 2006, at 2:14 AM, Michael Gentry wrote:

> I personally think writeNestedProperty() is a perfectly valid feature
> request to be added to Cayenne.  If you are already using OGNL, such
> as in a Tapestry application, that is also an option.  Keep in mind
> that nulls give OGNL heartburn, though.  I'm not certain what Cayenne
> does with them in readNestedProperty().  (EOF's KVC will return a null
> if it encounters a null, while OGNL throws an exception -- that
> feature complicated some of my Tapestry pages.)
>
> I might have to look at this a bit more later.
>
> /dev/mrg
>
> PS. If you create a working writeNestedProperty() before we can and
> feel like sharing, please do.
>
>
>
> On 6/29/06, apl@lindesay.co.nz <ap...@lindesay.co.nz> wrote:
>> Hello Andrus;
>>
>> >> Can I ask if there's something like 'takeValueForKeyPath(...)'
>> >> from KVC that can be used with 'DataObject'?  I was looking for a
>> >> 'writeNestedProperty', but couldn't see it.
>> ...
>> > No, unfortunately there's none. Should be easy to add via a custom
>> > wedge class sitting between CayenneDataObject and your own class
>> > (configurable in the Modeler)
>>
>> Is your thinking that it would best to get people to use something
>> like OGNL on Cayenne instead of  putting this stuff into cayenne  
>> itself?
>>
>> Regards;
>>
>> ___
>> Andrew Lindesay
>> www.lindesay.co.nz
>>
>>
>>
>>
>


Re: Re: writeNestedProperty

Posted by Michael Gentry <bl...@gmail.com>.
I personally think writeNestedProperty() is a perfectly valid feature
request to be added to Cayenne.  If you are already using OGNL, such
as in a Tapestry application, that is also an option.  Keep in mind
that nulls give OGNL heartburn, though.  I'm not certain what Cayenne
does with them in readNestedProperty().  (EOF's KVC will return a null
if it encounters a null, while OGNL throws an exception -- that
feature complicated some of my Tapestry pages.)

I might have to look at this a bit more later.

/dev/mrg

PS. If you create a working writeNestedProperty() before we can and
feel like sharing, please do.



On 6/29/06, apl@lindesay.co.nz <ap...@lindesay.co.nz> wrote:
> Hello Andrus;
>
> >> Can I ask if there's something like 'takeValueForKeyPath(...)'
> >> from KVC that can be used with 'DataObject'?  I was looking for a
> >> 'writeNestedProperty', but couldn't see it.
> ...
> > No, unfortunately there's none. Should be easy to add via a custom
> > wedge class sitting between CayenneDataObject and your own class
> > (configurable in the Modeler)
>
> Is your thinking that it would best to get people to use something
> like OGNL on Cayenne instead of  putting this stuff into cayenne itself?
>
> Regards;
>
> ___
> Andrew Lindesay
> www.lindesay.co.nz
>
>
>
>

Re: writeNestedProperty

Posted by ap...@lindesay.co.nz.
Hello Andrus;

>> Can I ask if there's something like 'takeValueForKeyPath(...)'  
>> from KVC that can be used with 'DataObject'?  I was looking for a  
>> 'writeNestedProperty', but couldn't see it.
...
> No, unfortunately there's none. Should be easy to add via a custom  
> wedge class sitting between CayenneDataObject and your own class  
> (configurable in the Modeler)

Is your thinking that it would best to get people to use something  
like OGNL on Cayenne instead of  putting this stuff into cayenne itself?

Regards;

___
Andrew Lindesay
www.lindesay.co.nz




RE: writeNestedProperty

Posted by "Gentry, Michael (Contractor)" <mi...@fanniemae.com>.
You must've read my mind ...



-----Original Message-----
From: Andrus Adamchik [mailto:andrus@objectstyle.org] 
Sent: Thursday, June 29, 2006 9:52 AM
To: cayenne-user@incubator.apache.org
Subject: Re: writeNestedProperty


The same is true for "readNestedProperty" - if the list is returned  
somewhere in the middle of the path an exception is thrown. If you  
want to customize this behavior, it is totally up to you.

Andrus


On Jun 29, 2006, at 2:45 PM, Gentry, Michael ((Contractor)) wrote:

> I'd think it would be fairly easy to write this, but what do you do if
> the last item in the path returns a List of objects instead of a  
> single
> object?  Apply the value to all of them or throw an exception?
>
> /dev/mrg
>
> -----Original Message-----
> From: Andrus Adamchik [mailto:andrus@objectstyle.org]
> Sent: Thursday, June 29, 2006 9:32 AM
> To: cayenne-user@incubator.apache.org
> Subject: Re: writeNestedProperty
>
>
> Hi Andrew,
>
> No, unfortunately there's none. Should be easy to add via a custom
> wedge class sitting between CayenneDataObject and your own class
> (configurable in the Modeler)
>
> Andrus
>
> On Jun 29, 2006, at 1:58 PM, apl@lindesay.co.nz wrote:
>
>> Hello;
>>
>> Can I ask if there's something like 'takeValueForKeyPath(...)' from
>> KVC that can be used with 'DataObject'?  I was looking for a
>> 'writeNestedProperty', but couldn't see it.
>>
>> Regards;
>>
>> ___
>> Andrew Lindesay
>> www.lindesay.co.nz
>>
>>
>>
>>
>
>


Re: writeNestedProperty

Posted by Andrus Adamchik <an...@objectstyle.org>.
The same is true for "readNestedProperty" - if the list is returned  
somewhere in the middle of the path an exception is thrown. If you  
want to customize this behavior, it is totally up to you.

Andrus


On Jun 29, 2006, at 2:45 PM, Gentry, Michael ((Contractor)) wrote:

> I'd think it would be fairly easy to write this, but what do you do if
> the last item in the path returns a List of objects instead of a  
> single
> object?  Apply the value to all of them or throw an exception?
>
> /dev/mrg
>
> -----Original Message-----
> From: Andrus Adamchik [mailto:andrus@objectstyle.org]
> Sent: Thursday, June 29, 2006 9:32 AM
> To: cayenne-user@incubator.apache.org
> Subject: Re: writeNestedProperty
>
>
> Hi Andrew,
>
> No, unfortunately there's none. Should be easy to add via a custom
> wedge class sitting between CayenneDataObject and your own class
> (configurable in the Modeler)
>
> Andrus
>
> On Jun 29, 2006, at 1:58 PM, apl@lindesay.co.nz wrote:
>
>> Hello;
>>
>> Can I ask if there's something like 'takeValueForKeyPath(...)' from
>> KVC that can be used with 'DataObject'?  I was looking for a
>> 'writeNestedProperty', but couldn't see it.
>>
>> Regards;
>>
>> ___
>> Andrew Lindesay
>> www.lindesay.co.nz
>>
>>
>>
>>
>
>


RE: writeNestedProperty

Posted by "Gentry, Michael (Contractor)" <mi...@fanniemae.com>.
Actually, this reminds me of something else I stumbled upon a LONG time
ago.  I don't have a good test case handy, so my details might be a bit
off.

If you have a Department with a to-many to Person, and Person has a
string emailAddress, Cayenne won't let you do this (or at least wouldn't
when I tried it):

List addresses =
manager.readNestedProperty("department.people.emailAddress");

Cayenne didn't want to handle that.  EOF supports it.  Is there any
reason we shouldn't be able to handle this?  (Assuming it still doesn't
handle it.)

/dev/mrg



-----Original Message-----
From: Gentry, Michael (Contractor) [mailto:michael_gentry@fanniemae.com]

Sent: Thursday, June 29, 2006 9:46 AM
To: cayenne-user@incubator.apache.org
Subject: RE: writeNestedProperty


I'd think it would be fairly easy to write this, but what do you do if
the last item in the path returns a List of objects instead of a single
object?  Apply the value to all of them or throw an exception?

/dev/mrg

-----Original Message-----
From: Andrus Adamchik [mailto:andrus@objectstyle.org] 
Sent: Thursday, June 29, 2006 9:32 AM
To: cayenne-user@incubator.apache.org
Subject: Re: writeNestedProperty


Hi Andrew,

No, unfortunately there's none. Should be easy to add via a custom  
wedge class sitting between CayenneDataObject and your own class  
(configurable in the Modeler)

Andrus

On Jun 29, 2006, at 1:58 PM, apl@lindesay.co.nz wrote:

> Hello;
>
> Can I ask if there's something like 'takeValueForKeyPath(...)' from  
> KVC that can be used with 'DataObject'?  I was looking for a  
> 'writeNestedProperty', but couldn't see it.
>
> Regards;
>
> ___
> Andrew Lindesay
> www.lindesay.co.nz
>
>
>
>


RE: writeNestedProperty

Posted by "Gentry, Michael (Contractor)" <mi...@fanniemae.com>.
I'd think it would be fairly easy to write this, but what do you do if
the last item in the path returns a List of objects instead of a single
object?  Apply the value to all of them or throw an exception?

/dev/mrg

-----Original Message-----
From: Andrus Adamchik [mailto:andrus@objectstyle.org] 
Sent: Thursday, June 29, 2006 9:32 AM
To: cayenne-user@incubator.apache.org
Subject: Re: writeNestedProperty


Hi Andrew,

No, unfortunately there's none. Should be easy to add via a custom  
wedge class sitting between CayenneDataObject and your own class  
(configurable in the Modeler)

Andrus

On Jun 29, 2006, at 1:58 PM, apl@lindesay.co.nz wrote:

> Hello;
>
> Can I ask if there's something like 'takeValueForKeyPath(...)' from  
> KVC that can be used with 'DataObject'?  I was looking for a  
> 'writeNestedProperty', but couldn't see it.
>
> Regards;
>
> ___
> Andrew Lindesay
> www.lindesay.co.nz
>
>
>
>


Re: writeNestedProperty

Posted by Andrus Adamchik <an...@objectstyle.org>.
Hi Andrew,

No, unfortunately there's none. Should be easy to add via a custom  
wedge class sitting between CayenneDataObject and your own class  
(configurable in the Modeler)

Andrus

On Jun 29, 2006, at 1:58 PM, apl@lindesay.co.nz wrote:

> Hello;
>
> Can I ask if there's something like 'takeValueForKeyPath(...)' from  
> KVC that can be used with 'DataObject'?  I was looking for a  
> 'writeNestedProperty', but couldn't see it.
>
> Regards;
>
> ___
> Andrew Lindesay
> www.lindesay.co.nz
>
>
>
>