> I got the impression that there was some sort of connection
> pooling built-in to Cayenne because in the Modeller there
> is a setting for minimum and maximum connections.  Now I'm
> getting confused and perhaps I'm using incorrect terminology.

As I said, I'm still stuck with Hibernate, so I'm quite fuzzy about exact 
details here.
However, I think it is entirely possible that Cayenne already has some built-in 
connection pooling. In a J2SE context, it would essentially just be a 
connection recreator.

> In my mind there is the actual connection to the database
> as defined during the creation of the DataContext.

No, a DataContext is a context within which retrieving the same rows via some 
query will always give you identical Java objects.
That's a pretty powerful (and important) property, but not necessarily related 
to a connection. (Connections become important as soon as you need 
transaction-related guarantees.)

You don't need to create an ObjectContext to work with a DataContext - any 
DataContext already is an ObjectContext.
You don't roll back a database transaction here, you roll back to whatever was 
last loaded from the database.
If you use child contexts, you can roll back to whatever the state was when 
that child context was started.

I believe that this means that you may have data loaded in different 
transactions in your application, and that that is the price you pay for 
getting rid of LazyInitializationExceptions. (True Cayenne experts, please 
correct if that's wrong. I'm writing this both to help Andrew along and to get 
helped along ;-) )

Reply via email to