You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Warner Onstine <sw...@warneronstine.com> on 2003/11/14 00:44:49 UTC

hibernate - where to put it?

Ok, So I am making progress on things (thanks to everyone for 
pointers). My next question is, where is the best place to put a 
Hibernate service (that is until HiveMind comes back)?

Right now I decided to create my own Globals class that has 
synchronized methods for getting the Session and SessionFactory from 
Hibernate. Is this the best place to put it? (Note - I am working from 
the Vlib example).

Thanks in advance.

-warner



---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org


Re: hibernate - where to put it?

Posted by Warner Onstine <sw...@warneronstine.com>.
On Thursday November 13th 2003, Paul Ferraro wrote:

> The Global object is probably your best bet.  The Global object is
> stored in the servlet context, and is ideal for storing references to
> global resources/services.  Question - Why the need to synchronize
> anything?  Why not just store a single reference to a SessionFactory in
> the global object?  The SessionFactory is immutable object and its
> methods (specifically, openSession()) are thread-safe.  Thoughts?

As I said, I was just going by the example in Vlib. It's possible it was synchronized because it was dealing with JNDI lookups for EJB interfaces, not sure.

-warner

> Paul Ferraro
> Warner Onstine wrote:
> > Ok, So I am making progress on things (thanks to everyone for
> > pointers). My next question is, where is the best place to put a
> > Hibernate service (that is until HiveMind comes back)?
> >
> > Right now I decided to create my own Globals class that has
> > synchronized methods for getting the Session and SessionFactory from
> > Hibernate. Is this the best place to put it? (Note - I am working from
> > the Vlib example).
> >
> > Thanks in advance.
> >
> > -warner
> >
> >
> >
> > ---------------------------------------------------------------------
> > 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

---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org


Re: hibernate - where to put it?

Posted by Paul Ferraro <pm...@columbia.edu>.
The Global object is probably your best bet.  The Global object is 
stored in the servlet context, and is ideal for storing references to 
global resources/services.  Question - Why the need to synchronize 
anything?  Why not just store a single reference to a SessionFactory in 
the global object?  The SessionFactory is immutable object and its 
methods (specifically, openSession()) are thread-safe.  Thoughts?

Paul Ferraro


Warner Onstine wrote:

> Ok, So I am making progress on things (thanks to everyone for 
> pointers). My next question is, where is the best place to put a 
> Hibernate service (that is until HiveMind comes back)?
>
> Right now I decided to create my own Globals class that has 
> synchronized methods for getting the Session and SessionFactory from 
> Hibernate. Is this the best place to put it? (Note - I am working from 
> the Vlib example).
>
> Thanks in advance.
>
> -warner
>
>
>
> ---------------------------------------------------------------------
> 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


Re: hibernate - where to put it?

Posted by Glen Stampoultzis <gs...@iinet.net.au>.
Hi,

It seems to me this stuffers from a flaw.  It doesn't check for version 
changes so there's no optimistic locking.  That is between viewing the 
contact data and hitting submit someone else might update the data those 
updates will be clobbered.


Regards,

Glen

At 02:40 PM 14/11/2003, you wrote:
>http://nemesisit.rdsnet.ro/opendocs/tapehibe2/tapehibe2.html (example
>code here)

Re: hibernate - where to put it?

Posted by Marilen Corciovei <le...@nemesisit.rdsnet.ro>.
http://nemesisit.rdsnet.ro/opendocs/tapehibe2/tapehibe2.html (example
code here)

On Fri, 2003-11-14 at 01:44, Warner Onstine wrote:

> Ok, So I am making progress on things (thanks to everyone for 
> pointers). My next question is, where is the best place to put a 
> Hibernate service (that is until HiveMind comes back)?
> 
> Right now I decided to create my own Globals class that has 
> synchronized methods for getting the Session and SessionFactory from 
> Hibernate. Is this the best place to put it? (Note - I am working from 
> the Vlib example).
> 
> Thanks in advance.
> 
> -warner
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org



Re: hibernate - where to put it?

Posted by Colin Sampaleanu <co...@exis.com>.
I would highly recommend taking a look at the Spring framework. It's a 
lightweight container, similar in some respects to HiveMind. However, it 
also has a bunch of integrated Hibernate related helper code, which 
makes using Hibernate much much nicer. Here's an article I wrote on 
integrating Tapestry and Spring:
  http://www.springframework.org/docs/integration/tapestry.html
If you want to know about the Hibernate related stuff in Spring, take a 
look here:
  http://www.hibernate.org/110.html
The Spring website itself is at:
  http://www.springframework.org


Warner Onstine wrote:

> Ok, So I am making progress on things (thanks to everyone for 
> pointers). My next question is, where is the best place to put a 
> Hibernate service (that is until HiveMind comes back)?
>
> Right now I decided to create my own Globals class that has 
> synchronized methods for getting the Session and SessionFactory from 
> Hibernate. Is this the best place to put it? (Note - I am working from 
> the Vlib example).
>
> Thanks in advance.





---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org