You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@cayenne.apache.org by Aristedes Maniatis <ar...@maniatis.org> on 2007/08/16 15:06:58 UTC

Re: ObjectContext & Factory

Moving to user@...

On 16/08/2007, at 9:02 PM, Adrian Wiesmann wrote:

> Could anybody please help me out with an example of how to use
> ObjectContextFactory, ObjectContext and ObjectContextDecorator? I  
> would
> like to write some code which makes sure that every ObjectContext  
> created
> in my application is created by my own factory which automatically  
> adds a
> decorator (and idirectly lifecycle callbacks). I am mostly  
> interested to
> see how my own factory could first call the "base" implementation (not
> sure what and where the "base" is). I got it working with
> DataContextFactory but ObjectContext seems to be a little bit  
> different to
> that.

With a recent commit [1] to 3.0 after M1, you may no longer need to  
add a decorator at all if you just want to add lifecycle callbacks.

Ari Maniatis


[1] http://svn.apache.org/viewvc?view=rev&revision=560812



-------------------------->
Aristedes Maniatis
phone +61 2 9660 9700
PGP fingerprint 08 57 20 4B 80 69 59 E2  A9 BF 2D 48 C2 20 0C C8



Re: Order of commits

Posted by Andrus Adamchik <an...@objectstyle.org>.
Yeah, EntitySorter is the only one, but it doesn't change basic  
algorithm of insert -> update -> delete. Jan, if you could explain  
what are you trying to accomplish, there may be another solution.

Andrus


On Aug 21, 2007, at 5:53 PM, Mike Kienenberger wrote:

> Looks like the query order is defined here:
>
> org.objectstyle.cayenne.access.DataDomainFlushAction.preprocess 
> (DataContext
> context)
>
> I don't see any user-interceptable hooks here yet.
>
> A place that might make sense is in
> org.objectstyle.cayenne.access.DataDomainFlushAction.flush() after
> preprocess() but before runQueries().   Send the Query list to a
> delegate for order changing.
>
> This is all for Cayenne 1.2/2.0.  Not sure how 3.0 differs.
>
> On 8/21/07, Jan Lendholt <jl...@hotmail.com> wrote:
>> Hey Folks,
>>
>> is it somehow possible to fire the different statements in a  
>> specific order?
>> It would be necessary to delete before insert... any solution  
>> herefor?
>>
>> TIA!
>>
>> Jan
>


Re: Order of commits

Posted by Mike Kienenberger <mk...@gmail.com>.
Looks like the query order is defined here:

org.objectstyle.cayenne.access.DataDomainFlushAction.preprocess(DataContext
context)

I don't see any user-interceptable hooks here yet.

A place that might make sense is in
org.objectstyle.cayenne.access.DataDomainFlushAction.flush() after
preprocess() but before runQueries().   Send the Query list to a
delegate for order changing.

This is all for Cayenne 1.2/2.0.  Not sure how 3.0 differs.

On 8/21/07, Jan Lendholt <jl...@hotmail.com> wrote:
> Hey Folks,
>
> is it somehow possible to fire the different statements in a specific order?
> It would be necessary to delete before insert... any solution herefor?
>
> TIA!
>
> Jan
>
> _________________________________________________________________
> Sie suchen E-Mails, Dokumente oder Fotos? Die neue MSN Suche Toolbar mit
> Windows-Desktopsuche liefert in sekundenschnelle Ergebnisse. Jetzt neu!
> http://desktop.msn.de/ Jetzt gratis downloaden!
>
>

Re: ObjectContext & Factory

Posted by Andrus Adamchik <an...@objectstyle.org>.
More to the point ... The two ways to instantiate DataContext  
provided by Cayenne framework that are using DataContextFactory  
behind the scenes (DataContext.createDataContext() and  
WebApplicationContextFilter) may need to be migrated to something  
that returns ObjectContext instead. But keep in mind that those are  
just utilities and you don't have to use them (and  
DataContextFactory). You can create your own context in your code,  
skipping the factory.

Andrus



On Aug 16, 2007, at 9:13 AM, Andrus Adamchik wrote:
>>>
>>> On 16/08/2007, at 9:02 PM, Adrian Wiesmann wrote:
>>>
>>>> Could anybody please help me out with an example of how to use
>>>> ObjectContextFactory, ObjectContext and ObjectContextDecorator?  
>>>> I would
>>>> like to write some code which makes sure that every  
>>>> ObjectContext created
>>>> in my application is created by my own factory which  
>>>> automatically adds a
>>>> decorator (and idirectly lifecycle callbacks). I am mostly  
>>>> interested to
>>>> see how my own factory could first call the "base"  
>>>> implementation (not
>>>> sure what and where the "base" is). I got it working with
>>>> DataContextFactory but ObjectContext seems to be a little bit  
>>>> different to
>>>> that.


Order of commits

Posted by Jan Lendholt <jl...@hotmail.com>.
Hey Folks,

is it somehow possible to fire the different statements in a specific order? 
It would be necessary to delete before insert... any solution herefor?

TIA!

Jan

_________________________________________________________________
Sie suchen E-Mails, Dokumente oder Fotos? Die neue MSN Suche Toolbar mit 
Windows-Desktopsuche liefert in sekundenschnelle Ergebnisse. Jetzt neu! 
http://desktop.msn.de/ Jetzt gratis downloaden!


Re: ObjectContext & Factory

Posted by Andrus Adamchik <an...@objectstyle.org>.
I meant "wasn't ONLY about callbacks", as Adrian indeed mentions  
callbacks ... sorry need more coffee :-)

http://objectstyle.org/cayenne/lists/cayenne-devel/2007/08/0124.html

Andrus


On Aug 16, 2007, at 9:10 AM, Andrus Adamchik wrote:

> I think this wasn't about callbacks - Adrian develops his own  
> extensions that require a decorator.
>
> Andrus
>
>
> On Aug 16, 2007, at 9:06 AM, Aristedes Maniatis wrote:
>
>> Moving to user@...
>>
>> On 16/08/2007, at 9:02 PM, Adrian Wiesmann wrote:
>>
>>> Could anybody please help me out with an example of how to use
>>> ObjectContextFactory, ObjectContext and ObjectContextDecorator? I  
>>> would
>>> like to write some code which makes sure that every ObjectContext  
>>> created
>>> in my application is created by my own factory which  
>>> automatically adds a
>>> decorator (and idirectly lifecycle callbacks). I am mostly  
>>> interested to
>>> see how my own factory could first call the "base" implementation  
>>> (not
>>> sure what and where the "base" is). I got it working with
>>> DataContextFactory but ObjectContext seems to be a little bit  
>>> different to
>>> that.
>>
>> With a recent commit [1] to 3.0 after M1, you may no longer need  
>> to add a decorator at all if you just want to add lifecycle  
>> callbacks.
>>
>> Ari Maniatis
>>
>>
>> [1] http://svn.apache.org/viewvc?view=rev&revision=560812
>>
>>
>>
>> -------------------------->
>> Aristedes Maniatis
>> phone +61 2 9660 9700
>> PGP fingerprint 08 57 20 4B 80 69 59 E2  A9 BF 2D 48 C2 20 0C C8
>>
>>
>


Re: ObjectContext & Factory

Posted by Andrus Adamchik <an...@objectstyle.org>.
I think this wasn't about callbacks - Adrian develops his own  
extensions that require a decorator.

Andrus


On Aug 16, 2007, at 9:06 AM, Aristedes Maniatis wrote:

> Moving to user@...
>
> On 16/08/2007, at 9:02 PM, Adrian Wiesmann wrote:
>
>> Could anybody please help me out with an example of how to use
>> ObjectContextFactory, ObjectContext and ObjectContextDecorator? I  
>> would
>> like to write some code which makes sure that every ObjectContext  
>> created
>> in my application is created by my own factory which automatically  
>> adds a
>> decorator (and idirectly lifecycle callbacks). I am mostly  
>> interested to
>> see how my own factory could first call the "base" implementation  
>> (not
>> sure what and where the "base" is). I got it working with
>> DataContextFactory but ObjectContext seems to be a little bit  
>> different to
>> that.
>
> With a recent commit [1] to 3.0 after M1, you may no longer need to  
> add a decorator at all if you just want to add lifecycle callbacks.
>
> Ari Maniatis
>
>
> [1] http://svn.apache.org/viewvc?view=rev&revision=560812
>
>
>
> -------------------------->
> Aristedes Maniatis
> phone +61 2 9660 9700
> PGP fingerprint 08 57 20 4B 80 69 59 E2  A9 BF 2D 48 C2 20 0C C8
>
>