Transactions start at "commitChanges".  Cayenne's feel is much more like svn to 
me than hibernate.  You "check out" objects (fetch them from the db) to your 
working "directory" (the object context).  You modify them, delete them, add 
new ones, etc.  Then a call to "commitChanges" sends everything back to the db 
in a single transaction, very much analogous to svn commit.  And 
rollbackChanges is very much analogous to svn -R revert .

Robert

On Jul 25, 2011, at 7/2511:01 AM , Christian Grobmeier wrote:

>> Since ObjectContext (server or ROP client) is a "disconnected" object in 
>> Cayenne transactions are something different compared to say Hibernate 
>> (that's my guess anyways, I don't know much about Hibernate). Cayenne server 
>> transactions are a "bridge" to JDBC transactions (there's not Cayenne 
>> specific transactional behavior, other than locking a JDBC connection for 
>> the operation duration, and allowing users to delineate a custom JDBC tx 
>> scope).
> 
> Very interesting for me, as I write about transaction for the article
> at the moment.
> 
> You wrote, ObjectContext is some kind of a "disconnected" object. If I
> create two new objects in the ObjectContext, when does the transaction
> start exactly? Is it when I call "registerNew" on the first object or
> is it when I commit my changes (it then would create a transaction,
> commit both new objects, close transaction)?
> 
>> 
>> Since there's no JDBC on the ROP client, there are no Cayenne transaction 
>> there. Potentially we can extend this abstraction to the client, but it was 
>> thought originally that this will break a simple request/response 
>> webservice'y feel of ROP.
> 
> Makes perfect sense
> Cheers
> 
> 
>> 
>> Andrus
>> 
>> 
>> On Jul 25, 2011, at 6:18 PM, Christian Grobmeier wrote:
>> 
>>>>> I was just surprise that getDataDomain() is not in CayenneRuntime. It
>>>>> seemed to me that would be the logical place. I can see getChannel and
>>>>> getContext is in CayenneRuntime too. So, why not getDataDomain?
>>>> 
>>>> The answer is ROP. DataDomain is a "server" configuration object, and is 
>>>> not available in the "client" (ROP) configuration.
>>> 
>>> Ah understood
>>> 
>>> Does that mean a "ROP client" is not meant to work with transactions,
>>> only the "ROP server" is? (not knowing to much about ROP at the
>>> moment)
>>> 
>>> Cheers
>>> Christian
>>> 
>>>> 
>>>> Andrus
>>>> 
>>>> 
>>> 
>>> 
>>> 
>>> --
>>> http://www.grobmeier.de
>>> 
>> 
>> 
> 
> 
> 
> -- 
> http://www.grobmeier.de

Reply via email to