You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@cayenne.apache.org by MG...@escholar.com on 2010/04/05 22:26:01 UTC
jdbc connection
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
Re: jdbc connection
Posted by Andrey Razumovsky <ra...@gmail.com>.
CayenneContext is used for three-tier Cayenne (ROP) [1]. This is a very
interesting and major feature of Cayenne. No others currently.. I've thought
of GWTCayenneContext for GWT client side, but this is quite different
concept
[1]
http://cayenne.apache.org/doc30/remote-object-persistence-introduction.html
2010/4/6 <MG...@escholar.com>
> Out of mostly curiosity... What could the other contexts possibly be? I
> see BaseContext, which is there for specific implementations to inherit
> from, and CayenneContext, which I don't really understand. Would like an
> XMLContext or BinaryFileContext be examples of contexts in the future?
>
> -Mike
>
>
>
> From:
> Michael Gentry <mg...@masslight.net>
> To:
> user@cayenne.apache.org
> Date:
> 04/05/2010 05:02 PM
> Subject:
> Re: jdbc connection
>
>
>
> 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, <MG...@escholar.com> wrote:
> > Thanks guys. Will it always be safe to cast
> > BaseContext.getThreadObjectContext() to DataContext?
> >
> > -Mike
> >
> >
> >
> >
> > From:
> > Michael Gentry <mg...@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, <MG...@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
> >>
> >
> >
> >
>
>
>
--
Andrey
Re: jdbc connection
Posted by MG...@escholar.com.
Out of mostly curiosity... What could the other contexts possibly be? I
see BaseContext, which is there for specific implementations to inherit
from, and CayenneContext, which I don't really understand. Would like an
XMLContext or BinaryFileContext be examples of contexts in the future?
-Mike
From:
Michael Gentry <mg...@masslight.net>
To:
user@cayenne.apache.org
Date:
04/05/2010 05:02 PM
Subject:
Re: jdbc connection
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, <MG...@escholar.com> wrote:
> Thanks guys. Will it always be safe to cast
> BaseContext.getThreadObjectContext() to DataContext?
>
> -Mike
>
>
>
>
> From:
> Michael Gentry <mg...@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, <MG...@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
>>
>
>
>
Re: jdbc connection
Posted by Michael Gentry <mg...@masslight.net>.
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, <MG...@escholar.com> wrote:
> Thanks guys. Will it always be safe to cast
> BaseContext.getThreadObjectContext() to DataContext?
>
> -Mike
>
>
>
>
> From:
> Michael Gentry <mg...@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, <MG...@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
>>
>
>
>
Re: jdbc connection
Posted by MG...@escholar.com.
Thanks guys. Will it always be safe to cast
BaseContext.getThreadObjectContext() to DataContext?
-Mike
From:
Michael Gentry <mg...@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, <MG...@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
>
Re: jdbc connection
Posted by Michael Gentry <mg...@masslight.net>.
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, <MG...@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
>
Re: jdbc connection
Posted by Andrey Razumovsky <ra...@gmail.com>.
something like DataContext.getParentDataDomain().getDataNode(name). You're
right, this is a way to obtain a connection
2010/4/6 <MG...@escholar.com>
> 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
>
--
Andrey