cayenne-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andrus Adamchik <and...@objectstyle.org>
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  
interface:

http://cayenne.apache.org/doc30/api/org/apache/cayenne/conf/DataSourceFactory.html

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

Andrus


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: http://n3.nabble.com/Handling-multiple-databases-using-Cayenne-Spring-tp699967p699967.html
> Sent from the Cayenne - User mailing list archive at Nabble.com.
>


Mime
View raw message