I am not sure if you want the DataContext to be bound to the Visit object,
as the Visit object is serialized and saved in the the users HttpSession.
What about using some of the thread local DataContext patterns, provided by
Cayenne.
regards Malcolm Edgar
On 10/21/05, Andrew Pym <andre..ptimalexecution.biz> wrote:
>
> Tapestry 4 - implemented a Visit object
> Code is below
> I am relatively new to Cayenne and Tepstry so let me know if I could be
> doing things better.
>
> Couldn't see why you would do it in Spring as well
>
> Using Hivemind may give you more flexibility with services.
>
>
>
> Regards
>
> Andrew Pym
> Mobile 0417 416 569
> International + 61 417 416 569
>
>
> import java.io.Serializable;
> import org.objectstyle.cayenne.access.DataContext;
>
> /**
> * Based on examples from tapestry workbench and Cayenne Tapestry blog
> *..uthor Andrew Pym
> *..ince
> */
>
> public class IRVisit implements Serializable
> {
> private static final long serialVersionUID = -8506455811411321232L;
>
>
> public IRVisit() {
> this.dataContext = DataContext.createDataContext();
> }
>
>
> protected DataContext dataContext;
>
> public DataContext getDataContext() {
> if (dataContext == null) {
> dataContext = DataContext.createDataContext();
> }
> return dataContext;
> }
>
> }
>
>
>
> -----Original Message-----
> From: Mike Kienenberger [mailto:mkienen..mail.com]
> Sent: Friday, 21 October 2005 1:21 AM
> To: cayenne-use..bjectstyle.org
> Subject: Re: Searching for Examples of Cayenne + HiveMind
>
> You could also take a look at the cayenne-spring example and see if
> that helps. I'd imagine the concepts should be similar between
> HiveMind and Spring.
>
> On 10/20/05, Gentry, Michael (Contractor) <michael_gentr..anniemae.com>
> wrote:
> >
> > I've not had time to experiment with T4/HiveMind yet, but using T3 I
> have
> a
> > DataContext bound into my Visit (session) object and it works alright,
> so
> > I'd expect something similar with T4.
> >
> > Not sure if that helps or not ...
> >
> > /dev/mrg
> >
> >
> > -----Original Message-----
> > From: christian.mittendor..reenet.de
> > [mailto:christian.mittendor..reenet.de]
> > Sent: Thursday, October 20, 2005 5:10 AM
> > To: cayenne-use..bjectstyle.org
> > Subject: Searching for Examples of Cayenne + HiveMind
> >
> > Hello!
> >
> > With Tapestry 4 on the horizon I've started digging deeper into
> HiveMind.
> > Now I'm thinking about how to create a HiveMind Services that makes use
> of
> a
> > DataContext which is bound to a session. The obvious solution would be
> to
> > add the DataContext as a parameter to each method that's using it. But
> there
> > are probably other more elegant solutions possible that I don't see yet.
> > I've seen an example where Hibernate was used together with Tapestry and
> > HiveMind. Does anybody know of something compareable for Cayenne?
> >
> > Christian
> >
>
>
>
This archive was generated by hypermail 2.0.0 : Thu Oct 20 2005 - 19:34:50 EDT