Sorry, forgot to mention, you can @Inject if your Dao is a service in
tapestry-ioc...
On 28/02/2012 8:37 PM, Ferran Maylinch wrote:
About creating threads explicitly... do we need to use PerthreadManager?
I saw you recommend it here:
http://tapestry.1045711.n5.nabble.com/Reusing-tapestry-hiber
Ferran,
You can just @Inject the session in if you want to write less code:
class MyDAO {
@Inject private Session session;
public void performSomeOperationOnSession() {
...
}
}
and then yes, you must use PerThreadManager explicitly if you are
creating your own threads using the Dao.
About creating threads explicitly... do we need to use PerthreadManager?
I saw you recommend it here:
http://tapestry.1045711.n5.nabble.com/Reusing-tapestry-hibernate-session-in-a-thread-td5438833.html
On Tue, Feb 28, 2012 at 10:30 AM, Ferran Maylinch
wrote:
> Thank you very much for your answer
Thank you very much for your answers.
So, if I understood you well, I can let Tapestry inject the Session in my
DAOs this way:
class MyDAO {
private final Session session;
public MyDAO (Session session) {
this.session = session;
}
public void performSomeOperationOnSession() {
.
On Mon, 27 Feb 2012 20:55:28 -0300, Ferran Maylinch
wrote:
Hello,
Hi!
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 inj
On Mon, Feb 27, 2012 at 3:55 PM, Ferran Maylinch
wrote:
> 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
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
wrote:
> Hello,
>