Just inject the Session object; it's a proxy to the real per-thread
Session object. It's safe to share across instances and across
threads.  There's no reason to use the HibernateSessionSource or
HibernateSessionManager directly.

On Mon, Feb 27, 2012 at 3:55 PM, Ferran Maylinch
<ferranmayli...@gmail.com> wrote:
> Hello,
>
> This is surely a newbie question.
>
> Before posting here I tried (with no luck) to find information about how to
> use Session and/or HibernateSessionSource in my DAO's.
>
> We are currently using both approaches but we don't know exactly when to
> use each one.
> When should we inject a HibernateSessionSource into the DAO and create
> Sessions with source.create() and when should we directly inject a Session?
>
> In our application we have some DAOs calling other DAOs. What should I
> inject to them: a HibernateSessionSource or a Session? Or should I pass a
> Session to the DAO methods? Or DAOs calling other DAOs is discouraged?
>
> And a further question would be: what happens if a class starts several
> threads using Sessions and transactions. How should we handle that?
> Sometimes we suffer deadlocks but we can't spot the cause.
>
> Thank you very much,
>
> Ferran Maylinch



-- 
Howard M. Lewis Ship

Creator of Apache Tapestry

The source for Tapestry training, mentoring and support. Contact me to
learn how I can get you up and productive in Tapestry fast!

(971) 678-5210
http://howardlewisship.com

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org

Reply via email to