Re: Handling multiple databases using Cayenne+Spring

From: Andrus Adamchik (andru..bjectstyle.org)
Date: Tue Apr 06 2010 - 06:24:08 EDT

  • Next message: Malcolm Edgar: "Connection Leak Detection"

    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.
    >



    This archive was generated by hypermail 2.0.0 : Tue Apr 06 2010 - 06:24:45 EDT