You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@cayenne.apache.org by Cyp her <cy...@hotmail.com> on 2006/04/04 15:52:16 UTC
accessing cayenne sessions
Hi
I am a newbie to Cayenne but I have been developing with WebObjects for a
few years and though I would try something open source. I have been reading
a few articles on getting the DataContext namely this one
http://www.objectstyle.org/confluence/display/CAYDOC/Web+Applications but it
still leaves me a little bit confused.
My set up is Cayenne with Tapestry deployed to JBoss using Eclipse as the
development platform. So my questions are
* What is the best way of retrieving the session context (DataContext) on a
given page and tracking the changes over a workflow and eventually
committing the changes or discarding them?
* Can I do the same using Tapestry to achieve the same results i.e. are
there any Tapestry calls for getting the Session
* Are there any convenient methods for accessing the Session like in
WebObjects where there is a session class in the application?
* I have read some people opt to use Tapestry, Spring and Hibernate. What
are the advantages if there are any and can you use Tapestry, Spring and
Cayenne?
Thank you very much for your help and apologies if all the answersw are
somewhere in this mailing list.
Lawrence
_________________________________________________________________
Are you using the latest version of MSN Messenger? Download MSN Messenger
7.5 today! http://join.msn.com/messenger/overview
Re: accessing cayenne sessions
Posted by Mike Kienenberger <mk...@gmail.com>.
On 4/4/06, Cyp her <cy...@hotmail.com> wrote:
> * I have read some people opt to use Tapestry, Spring and Hibernate. What
> are the advantages if there are any and can you use Tapestry, Spring and
> Cayenne?
Probably the number one reason for any WO developer to use Cayenne
instead of Hibernate is because it's similar to EOF and there are many
former (and current) WO developers actively involved in this project,
and we speak the same language and generally do things the same way.
To get started, take a look at this:
http://www.objectstyle.org/cayenne/userguide/misc.html
If you're not sold on Tapestry yet, you might also to evalute the
click framework as another WO-like alternative.
http://click.sourceforge.net/
Re: accessing cayenne sessions
Posted by Andrus Adamchik <an...@objectstyle.org>.
On Apr 4, 2006, at 5:52 PM, Cyp her wrote:
> * What is the best way of retrieving the session context
> (DataContext) on a given page and tracking the changes over a
> workflow and eventually committing the changes or discarding them?
Cayenne 1.2 has a WebApplicationContextFilter:
http://objectstyle.org/confluence/display/CAYDOC/Servlet+2.3+Filter
It provides you access to the session DataContext regardless of the
framework you use (in the past I put it in Tapestry Visit instead,
but I don't bother anymore, the filter is more portable). If you
configure the filter per docs page above, you can always get the
session context anywhere in the app like this:
DataContext context = DataContext.getThreadDataContext();
> * I have read some people opt to use Tapestry, Spring and
> Hibernate. What are the advantages if there are any and can you use
> Tapestry, Spring and Cayenne?
Yeah, that's the right place to ask for an unbiased Cayenne vs.
Hibernate comparison ;-)
Hibernate is an ORM, so conceptually it is similar to Cayenne (and
EOF). Regarding the differences... Cayenne provides more EOF-like
experience in managing your object graph. I've heard an opinion from
a WO user that Hibernate is more like eoaccess (I guess he was
referring to the fact that you need to manage a number of low-level
details). In this respect Cayenne is eoaccess+eocontrol (and since
recently - also EO JavaClient, for those who care). DataContext is
very similar to EOEditingContext.
IMO when migrating from WO, switching from EOF to Cayenne is a
relatively minor thing compared to switching WO framework to any
other web front-end technology.
Andrus
Re: accessing cayenne sessions
Posted by Mike Kienenberger <mk...@gmail.com>.
On 4/4/06, Cyp her <cy...@hotmail.com> wrote:
> * Are there any convenient methods for accessing the Session like in
> WebObjects where there is a session class in the application?
In servlets, there's an HttpSession object that you can pull out of
the HttpServletRequest. Instead of being a subclassable object, it
instead holds references to a Map (think NSDictionary) where you can
store objects the entire session. How you get a reference to your
HttpSession object depends on the framework.
http://java.sun.com/products/servlet/2.3/javadoc/javax/servlet/http/HttpSession.html