You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Miles Egan <mi...@caddr.com> on 2003/04/18 04:47:20 UTC

database persistence and o/r libraries

I'm working on replacing my hand-rolled database persistence code with
Hibernate.  So far everything's working well but it's not completely
clear to me where I should flush and clear transactions.  Other
discussions on this list seem to suggest that a custom IMonitor class is
the best approach.  Is this the case?  If so, which are the most
appropriate events in which to start/end transactions?  The page request
event cycle is still a bit unclear to me.

Tapestry + Hibernate is a pretty cool combination.  Just looking at most
of my page implementations you'd never guess a database even is
involved.

Slightly off topic - any strong preferences for Hibernate vs Cayenne? 
I'm using Hibernate right now because of the XDoclet support but I could
easily be swayed.

miles


Re: database persistence and o/r libraries

Posted by Jan Mikkelsen <jm...@adslhome.dk>.
Thanks Eric

On Fri, 18 Apr 2003 12:43:06 -0500
Eric Everman <ev...@precedadesign.com> wrote:

> My Hibernate related classes are attached.  I think its rather self 
> explanitory, but the very short version is:
> 
> HibernateMonitor - Allows page & component access to Hibernate sessions and 
> ensures they are closed at the end of a request.
> HibernateSessionSource - Simple class to wrap session access.  Not visible 
> in Tapestry app, but useful for testing.
> HibernateEngine - Engine subclass that builds HibernateMonitors
> 
> Cheers,
> 
> Eric Everman
> 
> At 4/18/2003, Miles Egan wrote:
> >Please do.  I think I understand how the IMonitor interface would be
> >used but it's not clear to me where the BaseEngine would fit in.
> >
> >On Fri, 2003-04-18 at 08:05, Eric Everman wrote:
> > > Jan-
> > >
> > > Several people have been using a combination of the IMonitor Interface and
> > > a BaseEngine subclass.  Its not currently possible to use *just* the
> > > IMonitor Interface, though there is talk of changing the interface to make
> > > this sort of thing easier.
> > >
> > > I can send you my code - its a collage of my work and others (see email
> > > address at bottom)
> > >
> > > Cheers,
> > >
> > > Eric Everman
> > > everman -at- precedadesign -dot- com



Re: database persistence and o/r libraries

Posted by Miles Egan <mi...@caddr.com>.
Thanks very much.  Seems pretty straightforward.

On Fri, 2003-04-18 at 10:43, Eric Everman wrote:
> My Hibernate related classes are attached.  I think its rather self 
> explanitory, but the very short version is:
> 
> HibernateMonitor - Allows page & component access to Hibernate sessions and 
> ensures they are closed at the end of a request.
> HibernateSessionSource - Simple class to wrap session access.  Not visible 
> in Tapestry app, but useful for testing.
> HibernateEngine - Engine subclass that builds HibernateMonitors
> 
> Cheers,
> 
> Eric Everman
> 
> At 4/18/2003, Miles Egan wrote:
> >Please do.  I think I understand how the IMonitor interface would be
> >used but it's not clear to me where the BaseEngine would fit in.
> >
> >On Fri, 2003-04-18 at 08:05, Eric Everman wrote:
> > > Jan-
> > >
> > > Several people have been using a combination of the IMonitor Interface and
> > > a BaseEngine subclass.  Its not currently possible to use *just* the
> > > IMonitor Interface, though there is talk of changing the interface to make
> > > this sort of thing easier.
> > >
> > > I can send you my code - its a collage of my work and others (see email
> > > address at bottom)
> > >
> > > Cheers,
> > >
> > > Eric Everman
> > > everman -at- precedadesign -dot- com
> 
> ______________________________________________________________________
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
-- 
Miles Egan <mi...@caddr.com>

Re: database persistence and o/r libraries

Posted by Eric Everman <ev...@precedadesign.com>.
My Hibernate related classes are attached.  I think its rather self 
explanitory, but the very short version is:

HibernateMonitor - Allows page & component access to Hibernate sessions and 
ensures they are closed at the end of a request.
HibernateSessionSource - Simple class to wrap session access.  Not visible 
in Tapestry app, but useful for testing.
HibernateEngine - Engine subclass that builds HibernateMonitors

Cheers,

Eric Everman

At 4/18/2003, Miles Egan wrote:
>Please do.  I think I understand how the IMonitor interface would be
>used but it's not clear to me where the BaseEngine would fit in.
>
>On Fri, 2003-04-18 at 08:05, Eric Everman wrote:
> > Jan-
> >
> > Several people have been using a combination of the IMonitor Interface and
> > a BaseEngine subclass.  Its not currently possible to use *just* the
> > IMonitor Interface, though there is talk of changing the interface to make
> > this sort of thing easier.
> >
> > I can send you my code - its a collage of my work and others (see email
> > address at bottom)
> >
> > Cheers,
> >
> > Eric Everman
> > everman -at- precedadesign -dot- com

Re: database persistence and o/r libraries

Posted by Miles Egan <mi...@caddr.com>.
Please do.  I think I understand how the IMonitor interface would be
used but it's not clear to me where the BaseEngine would fit in.

On Fri, 2003-04-18 at 08:05, Eric Everman wrote:
> Jan-
> 
> Several people have been using a combination of the IMonitor Interface and 
> a BaseEngine subclass.  Its not currently possible to use *just* the 
> IMonitor Interface, though there is talk of changing the interface to make 
> this sort of thing easier.
> 
> I can send you my code - its a collage of my work and others (see email 
> address at bottom)
> 
> Cheers,
> 
> Eric Everman
> everman -at- precedadesign -dot- com
> 
> At 4/18/2003, Jan Mikkelsen wrote:
> >I'm new to Tapestry, but I have used Hibernate with Struts. That was a
> >nice combination. I have now decided to use Tapestry in the future, so
> >the first thing I need to do is to get Hibernate to work within the
> >framework. Maybe we could help each other at some point. Right now,
> >though, I would like to be on the receiving end, if you have something
> >you would like to share :)
> >
> >regards,
> >Jan
> >
> >
> >---------------------------------------------------------------------
> >To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> >For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
-- 
Miles Egan <mi...@caddr.com>

Re: database persistence and o/r libraries

Posted by Eric Everman <ev...@precedadesign.com>.
Jan-

Several people have been using a combination of the IMonitor Interface and 
a BaseEngine subclass.  Its not currently possible to use *just* the 
IMonitor Interface, though there is talk of changing the interface to make 
this sort of thing easier.

I can send you my code - its a collage of my work and others (see email 
address at bottom)

Cheers,

Eric Everman
everman -at- precedadesign -dot- com

At 4/18/2003, Jan Mikkelsen wrote:
>I'm new to Tapestry, but I have used Hibernate with Struts. That was a
>nice combination. I have now decided to use Tapestry in the future, so
>the first thing I need to do is to get Hibernate to work within the
>framework. Maybe we could help each other at some point. Right now,
>though, I would like to be on the receiving end, if you have something
>you would like to share :)
>
>regards,
>Jan
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: tapestry-user-help@jakarta.apache.org


Re: database persistence and o/r libraries

Posted by Miles Egan <mi...@caddr.com>.
On Fri, 2003-04-18 at 02:19, Jan Mikkelsen wrote:
> I'm new to Tapestry, but I have used Hibernate with Struts. That was a
> nice combination. I have now decided to use Tapestry in the future, so
> the first thing I need to do is to get Hibernate to work within the
> framework. Maybe we could help each other at some point. Right now,
> though, I would like to be on the receiving end, if you have something
> you would like to share :)

So far I have virtually no Tapestry specific Hibernate code.  I do a
lazy instantiation of my persistent object the first time it's accessed
and then just set its properties directly in the page's getX/setX
methods.  I establish the session in a custom global class.  The only
thing missing now is making sure changes get committed to the database
at the right times.

-- 
Miles Egan <mi...@caddr.com>

Re: database persistence and o/r libraries

Posted by Jan Mikkelsen <jm...@adslhome.dk>.
I'm new to Tapestry, but I have used Hibernate with Struts. That was a
nice combination. I have now decided to use Tapestry in the future, so
the first thing I need to do is to get Hibernate to work within the
framework. Maybe we could help each other at some point. Right now,
though, I would like to be on the receiving end, if you have something
you would like to share :)

regards,
Jan