Can you share some code example of the integration? Thanks, David
Robert Zeigler wrote: > > Hi Andreas, > > I'm using T5 + cayenne (2.x) right now. > > 1: > There are a variety of ways you could go about obtaining a data > context in your services. > 1) You could use the Cayenne-supplied servlet filter and obtain the > thread-local copy of the context > 2) You could use a RequestFilter to duplicate the functionality of the > Cayenne's servlet filter > 3) You could write a ContextProvider service, which provides the > context. > > In my case, I did a combination of 2 & 3. I use a request filter to > check associate a data context with a request + current thread, > (either on a session-by-session basis or on a request-by-request > basis). I also have a ContextProvider service which I inject into > other services (by specifying it as a parameter in the service's > constructor). Ultimately, my context provider grabs the (thread > local) context set by the request filter. > > 2: > I would advocate having a method like: getReadonlyContext() in your > context provider service, which would contain your single, app-wide > context. Then in your pages and components, you can @Inject your > ContextProvider and grab the context. > > 3: You can contribute ValueEncoders, PrimaryKeyEncoders, etc. into > tapestry to handle your data objects. > > 4: Cayenne handles transactions for you transparently, unless you > explicitly handle them yourself. > So, in general, you have your form; your form submits; you perform > your object manipulations, and then you dataContext.commitChanges(); > and all of those object manipulations will be wrapped in a db > transaction. > > Robert > > On Mar 5, 2008, at 3/56:05 AM , Andreas Pardeike wrote: > >> Hi, >> >> I have several T4 projects that use Cayenne successfully but now I >> would >> like to start a new project in T5. Though I think I got my head >> wrapped >> around the new IoC concept in T5, I still don't see the big picture. >> >> Maybe someone can provide me with pointers to examples or simply >> explain >> how I would set up the following: >> >> - My application *mostly* does data mining, that is, read-only >> access to >> a couple of databases >> >> - At a few places, I would need to have write access but it's simple >> and >> probably does not need transaction management (i.e. allow customers >> to >> update their email address) >> >> - In my old projects, I have a shopping basket that builds temporary >> dao >> objects until the user logs in. At that time, I merge those with the >> actual dao's from the database >> >> - At a single point in the app (submitting the order), I actually need >> transaction management >> >> - I would also love to go with Cayenne 3 and pojo dao's. >> >> My questions: >> >> 1) How do I provide an DataContext/ObjectContext to my services? Is it >> as simple as injecting a ContextProvider into the service >> constructors? >> >> 2) Since I don't need transaction management most of the time, can I >> simply >> use a global ASO that has a DataContext/ObjectContext which I then >> use >> in my page classes if necessary? >> >> 3) How do I solve the serialization problem that arises when I >> submit forms >> that contain dao's? >> >> 4) How do I handle my submit order where I *do* need transaction >> management? >> >> Any help appreciated, >> Andreas Pardeike >> >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: [EMAIL PROTECTED] >> For additional commands, e-mail: [EMAIL PROTECTED] > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > > -- View this message in context: http://www.nabble.com/T5%3A-Examples-for-Cayenne-integration--tp15848762p15860055.html Sent from the Tapestry - User mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]