cayenne-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andrus Adamchik <>
Subject Re: Handling multiple databases using Cayenne+Spring
Date Tue, 06 Apr 2010 10:24:08 GMT
DataContext itself is "disconnected" (i.e. it doesn't hold an open  
connection all the time). It obtains a JDBC connection temporarily as  
needed via Cayenne stack for the duration of a query or a commit. The  
Connection is checked out from a DataSource attached to the DataNode.  
So you can create a DataSource implementation bound to your Spring  
container. To do this, you need to implement DataSourceFactory  

and type the name of your implementation in the Modeler for the  
project DataNode "DataSource Factory" field.


On Apr 6, 2010, at 1:17 PM, Sudheer wrote:

> Hi,
> Our existing implementation uses Spring. Application creates a  
> Connection
> object for each login user and keeps the object in session unitl user
> logoff/session timeout. Now we are plugging part of implementation  
> with
> Cayenne.
> If we create DataContext for user session, does each user session  
> have two
> Connection objects?
> Is there a way to use existing Connection object while creating a
> DataContext?
> Any sample Cayenne code detailing access to multiple databases (E.g.  
> Oracle,
> SQL Server) that uses same schema? (on spring+cayenne)
> Thank You,
> Sudheer
> -- 
> View this message in context:
> Sent from the Cayenne - User mailing list archive at

View raw message