cayenne-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michael Gentry <mgen...@masslight.net>
Subject Re: jdbc connection
Date Mon, 05 Apr 2010 21:01:15 GMT
I don't know if this will always be the case, but 3.0 (in
WebApplicationContextFilter and ServletUtil) creates a DataContext:

            DataContext ctxt = (DataContext)
session.getAttribute(DATA_CONTEXT_KEY);

            if (ctxt == null) {
                ctxt = DataContext.createDataContext();
                session.setAttribute(ServletUtil.DATA_CONTEXT_KEY, ctxt);
            }

            return ctxt;

Maybe in 3.1 or greater this will change, but currently it should be
safe to cast to a DataContext.

mrg


On Mon, Apr 5, 2010 at 4:49 PM,  <MGargano@escholar.com> wrote:
> Thanks guys.  Will it always be safe to cast
> BaseContext.getThreadObjectContext() to DataContext?
>
> -Mike
>
>
>
>
> From:
> Michael Gentry <mgentry@masslight.net>
> To:
> user@cayenne.apache.org
> Date:
> 04/05/2010 04:46 PM
> Subject:
> Re: jdbc connection
>
>
>
> dataContext.getParentDataDomain().getNode("foo").getDataSource().getConnection()
> returns the Connection, I think.  Replace "foo" with the name of your
> DataNode.
>
> mrg
>
> On Mon, Apr 5, 2010 at 4:26 PM,  <MGargano@escholar.com> wrote:
>> What's the best way to get a direct handle to a jdbc connection in your
>> underlying pool.  It looked like getting it straight from DataNode was
> the
>> way to go, but then how do I get to my DataNode?  :)  Thanks.
>>
>> -Mike
>>
>
>
>

Mime
View raw message