The serialization of the Visit (or session, really) kind of annoys me.
I understand the reason why they do it, but sometimes you have different
needs and want a HUGE session object lying around, but don't want it
serialized. Of course, my thinking/bias comes from having done
WebObjects for a while (session isn't serialized to disk) and maybe I
just don't know enough about Tomcat/etc.
I've toyed with the idea of keeping the DataContexts (at least the
session-oriented ones) in the Global object (in a Map or similar) and
then using the Visit itself as the key to retrieve it. This way the
DataContext doesn't get serialized. Of course, if you are doing
clustering, you'll lose the ability to have failover (this is fine for
my current needs). Also, you have to handle session timeouts so you can
free the DataContext out of the Global object.
I haven't implemented this yet, but if anyone has constructive
criticism, fire away. :-)
Thanks,
/dev/mrg
-----Original Message-----
From: Malcolm Edgar [mailto:malcolm.edga..mail.com]
Sent: Thursday, October 20, 2005 7:35 PM
To: cayenne-use..bjectstyle.org
Subject: Re: Searching for Examples of Cayenne + HiveMind
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
<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 : Fri Oct 21 2005 - 09:29:36 EDT