I am also looking to do something like this Joseph.

I imagine creating a set of implementation neutral interfaces for all the IO
and providing actual persistence implementation through a service that has a
Cayenne flavour. This service would be wired up in hivemind, and receive the
DC via another service, see below.

I found these notes so far
http://wiki.apache.org/jakarta-hivemind/CayenneIntegration in the wiki,
which gives this code:
package de.example.hivemind.impl;

import org.objectstyle.cayenne.access.DataContext;

import de.example.hivemind.DataContextService;

public class DataContextServiceImpl implements DataContextService
{
        public DataContext getDataContext()
        {
                DataContext dc = DataContext.getThreadDataContext();
                if(dc == null) {
                        dc = DataContext.createDataContext();
                        DataContext.bindThreadDataContext(dc);
                }
                return dc;
        }
}

And also this http://wiki.apache.org/jakarta-hivemind/Examples regarding
Cayenne.

John

----- Original Message ----- 
From: "Joseph Hannon" <[EMAIL PROTECTED]>
To: "Tapestry users" <[email protected]>
Sent: Monday, November 14, 2005 7:24 PM
Subject: Help on getting a Cayenne DataContext using HiveMind service


Based on piece at
http://wiki.apache.org/jakarta-hivemind/CayenneIntegration,
I implemented the following to attempt access to the Cayenne DataContext
(DC) from a non Tapestry class (any class). I get my Visit object from
HiveMind, so I know HiveMind is working. I am using Tapestry 4.0-beta-11,
Cayenne 1.2M7, and HiveMind 1.1-rc-1 running on Jetty 5.1.5. My app starts
up with no problems, then I get an exception on calling to get a DC. I
called for a DC from my WebApp and with a JUnit test to see if either would
work, neither did.

Will someone suggest what I can do to get this service working, or at least
make it accessible first? Will this approach work when calling from non
Tapestry classes? Do you have a good example of getting a service to work? I
can just use that instead.

Thanks,
Joseph




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to