How you access various app services depends on your app. If you are using
injection, it is declarative and fairly trivial. If not, you can either use a
static singleton, or look things up in ServletContext. E.g. if you are using
CayenneFilter to bootstrap Cayenne, you’d do this:
ServletContext
Cool, and we are now discussing on the dev list how to make the API more
straightforward by removing the need to cast.
Andrus
On Sep 6, 2013, at 8:20 AM, Markus Reich wrote:
> Hi,
>
> works perfect!! API docu was just a bit confusing concerning the new method
> for creating a child context :-
Hi,
works perfect!! API docu was just a bit confusing concerning the new method
for creating a child context :-(
Thank you
Meex
2013/9/5 Andrus Adamchik
> Here is how you create a child context in 3.2 (in 3.1 'newContext' was
> called 'getContext', otherwise it is similar) :
>
> ObjectContext
Here is how you create a child context in 3.2 (in 3.1 'newContext' was called
'getContext', otherwise it is similar) :
ObjectContext context = runtime.newContext();
ObjectContext childContext = runtime.newContext((DataChannel) context);
I.e. the parent context is a channel of the child. The cast
You aren't creating the child context correctly. I don't recall the proper
way to do it in 3.1+
On Thu, Sep 5, 2013 at 8:11 AM, Markus Reich wrote:
> ah ok, thx!
>
> But I still don't understand the whole thing :-(
>
> No the test reacts like this
>
> @Test
> public void testChildContext()
ah ok, thx!
But I still don't understand the whole thing :-(
No the test reacts like this
@Test
public void testChildContext() {
// create test instance
MiiPickingcontainer container =
MiiPickingcontainer.createInstance(context, "", "", "JUNIT");
context.commitChanges();
You have to assign the result of localObject.
John
On Sep 5, 2013 12:59 AM, "Markus Reich" wrote:
> Hi,
>
> I've a question concering child contexts, when I add an object to a child
> context with method localObject, I thought the object is really from parent
> to child context?
>
> But when I r
JNDI source for all portlets so
> that all of them share a connection pool?
>
> Bruno
>
> -Mensagem original-
> De: Andrus Adamchik [mailto:and...@objectstyle.org]
> Enviada: quinta-feira, 23 de Setembro de 2010 08:45
> Para: user@cayenne.apache.org
> Assunto
-Mensagem original-
De: Andrus Adamchik [mailto:and...@objectstyle.org]
Enviada: quinta-feira, 23 de Setembro de 2010 08:45
Para: user@cayenne.apache.org
Assunto: Re: Child Contexts
Haven't read the earlier messages. So you are using nested contexts already. In
this case a switch from the n
Haven't read the earlier messages. So you are using nested contexts already. In
this case a switch from the nested contexts to ROP will probably be less
noticeable performance-wise (communication between child and parent layers will
still be somewhat slower). Still extra unneeded complexity, so
On Sep 22, 2010, at 2:17 AM, b...@holos.pt wrote:
> Can I use a Cayenne client on each portlet and create a cayenne server on a
> servlet to receive their requests? this way all database communication is
> done by the servlet and not by all portlets.
This is possible, but it will add not insigni
Hey Michael,
How silly of me! Cayenne gives me a even simpler solution for this! Can I
use a Cayenne client on each portlet and create a cayenne server on a
servlet to receive their requests? this way all database communication is
done by the servlet and not by all portlets.
Could I also do this?
Hi Bruno,
In a typical deployment to Tomcat/JBoss/etc, you would use JNDI and
let the container manage the database connections. It sounds to me
like you are doing a lot of hot redeploys (not restarting Tomcat) and
somehow the resources aren't being cleared up correctly for you. With
JNDI, the c
I'm using the regular way, through the Cayenne's DataNode XML file. But I
am open to suggestions :). I was thinking about configuring a global
resource on tomcat using JNDI that would return a DataContext, but i dont
know if everytime an application access the resource a new object is
created?
Tha
What are you using to provide your DB Connection Pool: JNDI, DBCP, or
Cayenne? What version of Cayenne are you using?
mrg
On Tue, Sep 21, 2010 at 3:03 PM, wrote:
> Hey Michael and Robert,
>
> Ok so i got the difference between context and connection. So how can i
> close all connections befor
I'm not an expert, but it seems like kind of a weird problem.
Normally, the connections aren't left open -- they are only open for
the length of time to commit a change. Maybe one is left open for
reading -- I don't remember.
This would be how you tell the PoolManager to close everything, though.
Hey Michael and Robert,
Ok so i got the difference between context and connection. So how can i
close all connections before closing an application, a servlet or a
portlet? My main problem here is that on each deploy of a new web
application the connections from former deployments stay on (like me
Hi Bruno,
The Child DataContext *might* share the same database connection as
the Parent DataContext. In general, you don't care about this,
though. The DataContext, on commitChanges(), will request a database
connection, use that connection for performing the commit, then return
the connection
Contexts and connections are more or less independent. There is a pool of
connections; there are one or more contexts. When a context needs a
connection, eg, to write to or read from teh database, it checks one out from
the pool, and returns it to the pool as soon as it is finished with the
c
19 matches
Mail list logo