> y, November 6, 2003, at 09:07 PM, Andrus Adamchik wrote:
>
>> Hi Mike,
>>
>> If I understand correctly, you are not using ORM features of Cayenne
>> in your app, and simply using it as a DataSource provider for a Struts
>> app that otherwise uses JDBC, right? You maybe loosing quiet some
>> functionality this way. ;-) If this is not the case, you can obtain
>> DataSource from Cayenne DataNode.
>
> I am using the ORM features of Cayenne, it's the closest thing to EOF
> w/o using WO. :-)
>
> Without any connection pool stuff i have the following:
>
> I have updated the init()s methods in an ExtendedActionServlet Class
> [it extends ActionServlet which extends HttpServlet...] to use the
> BasicServletConfiguration.initializeConfiguration() as per Cayenne
> UserGuide.
> Next I grab a DataContext via
> DataContext ctx =
> BasicServletConfiguration.getDefaultContext(session);
> when I need to play with Entitys.
>
> Now it looks as if the two different sessions (from a Safari browser
> and an IE browser) share the same connection to the database.
> Will Cayenne create new connections if needed? I did notice that the
> XXX.driver.xml file has a "connectionPool" min and max set.
>
> To use Connection pools...
> Finally, from the code below, Mike Kienenberger's reply, and the
> struts FAQ, I can create a connection from the PoolManager. The issue
> I have is, how to associate the DataContext with the Connection.
>
> Personally, I don't want to know about Connections, just DataContexts
> :-)
>
> Thanks for all of the help.
>
>
>
>> While sometime back I indeed advocated a standalone use of Cayenne
>> "conn" package, in the last few releases we decided that supporting a
>> standalone DataSource is somewhat outside the scope of Cayenne, and is
>> not our priority:
>>
>> http://objectstyle.org/cayenne/userguide/design/datasrc.html
>>
>>
>> Now back to your problem.... Per Struts FAQ at
>>
>> http://jakarta.apache.org/struts/faqs/database.html
>
> <snip>
>
>>
>> public class MyPool extends
>> org.objectstyle.cayenne.conn.DataSourceInfo implements DataSource {
>> PoolManager realPool;
>>
>> public Connection getConnection() throws SQLException {
>> checkRealPool();
>> return realPool;
>> }
>>
>> private synchronized void checkRealPool() {
>> if(realPool == null) {
>> realPool = new PoolManager(...);
>> }
>> }
>> ....
>> }
>>
>>
>> Regards
>> Andrus
>>
>>
>
>> <snip>
>
>> -[]
> Digital Color Image
> Phone: 856-662-5532
>
This archive was generated by hypermail 2.0.0 : Fri Nov 07 2003 - 19:53:44 EST