RE: tapestry, hibernate and timeout

2011-12-01 Thread bdm
Hello, 

I have figured out the good mysql/hibernate configuration ! 

With this hibernate.hbm.xml:


with this mysql timeout configuration:


and pom.xml dependencies (hibernate-version: 3.5.6-Final, tapestry: 5.3.0):


Bye !

--
View this message in context: 
http://tapestry.1045711.n5.nabble.com/tapestry-hibernate-and-timeout-tp5028844p5038417.html
Sent from the Tapestry - User mailing list archive at Nabble.com.

Re: tapestry, hibernate and timeout

2011-11-29 Thread Lenny Primak
Are you using glassfish?  Glassfish has connection pools built in. You can use 
those. I use them with success with JPA but I am pretty sure hibernate is very 
similar in this manner. 



On Nov 29, 2011, at 4:31 AM, bdm  wrote:

> Thanks ! I keep your solution if I can not configure properly C3P0 ...
> 
> --
> View this message in context: 
> http://tapestry.1045711.n5.nabble.com/tapestry-hibernate-and-timeout-tp5028844p5031723.html
> Sent from the Tapestry - User mailing list archive at Nabble.com.
> 
> -
> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
> For additional commands, e-mail: users-h...@tapestry.apache.org
> 

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



RE: tapestry, hibernate and timeout

2011-11-29 Thread bdm
Thanks ! I keep your solution if I can not configure properly C3P0 ...

--
View this message in context: 
http://tapestry.1045711.n5.nabble.com/tapestry-hibernate-and-timeout-tp5028844p5031723.html
Sent from the Tapestry - User mailing list archive at Nabble.com.

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



Re: tapestry, hibernate and timeout

2011-11-29 Thread bdm
Thanks, but I already use the C3P0 connection pool without success ... maybe
it's a configuration problem but I can not figured out what is it !

I have move the post to the "Tapestry - User" forum as suggested !

I'll still digging ...

--
View this message in context: 
http://tapestry.1045711.n5.nabble.com/tapestry-hibernate-and-timeout-tp5028844p5031673.html
Sent from the Tapestry - User mailing list archive at Nabble.com.

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



RE: tapestry, hibernate and timeout

2011-11-28 Thread Wechsung, Wulf
Hi Bdm,

I guess you should use connection pooling but if you want to manage your own 
connection I would do it like this:

Manage the JDBC connection as thread with per-request scope. I think the 
Connection is already an interface so you can do the following in APP Module:

@Scope(ScopeConstants.PERTHREAD)
public static Connection buildConnection(
@Inject final PerthreadManager perthreadManager,
) {
  Connection con = // establish connection here
perthreadManager.addThreadCleanupListener(new ThreadCleanupListener() {

@Override
public void threadDidCleanup() {
try {
con.close();
} catch (Throwable t) {
}
}
});
return con;

}

Beware! As I understand it, this will create a connection for every single 
request which is okay for an App that get's very little use but will scale 
horribly. Close will be called at the end of the request. Of course you can 
access the connection by putting 

@Inject
Private Connection con;

in your components, pages or services.

Hope this helps!

Kind Regards,
Wulf


-Original Message-
From: bdm [mailto:b...@imageau.eu] 
Sent: Montag, 28. November 2011 14:24
To: users@tapestry.apache.org
Subject: tapestry, hibernate and timeout

Hello,
I have got a problem with a small crud app developed with tapestry. This is
a low traffic application so it can be unused for more than one day before
we need it again. The problem is we got a timeout with the jdbc connection
and we need to restart the application container (Glassfish) to have the
jdbc connection up again.
It is getting boring ! :)

It seems I missed something in the tapestry application logic ! 
Is there a solution to close the session when the application has finished a
DB operation and open it only when needed ? 

Here is the stack trace:


Thanks !
BDM.

--
View this message in context: 
http://tapestry.1045711.n5.nabble.com/tapestry-hibernate-and-timeout-tp5028844p5028844.html
Sent from the Tapestry - User mailing list archive at Nabble.com.

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


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



tapestry, hibernate and timeout

2011-11-28 Thread bdm
Hello,
I have got a problem with a small crud app developed with tapestry. This is
a low traffic application so it can be unused for more than one day before
we need it again. The problem is we got a timeout with the jdbc connection
and we need to restart the application container (Glassfish) to have the
jdbc connection up again.
It is getting boring ! :)

It seems I missed something in the tapestry application logic ! 
Is there a solution to close the session when the application has finished a
DB operation and open it only when needed ? 

Here is the stack trace:


Thanks !
BDM.

--
View this message in context: 
http://tapestry.1045711.n5.nabble.com/tapestry-hibernate-and-timeout-tp5028844p5028844.html
Sent from the Tapestry - User mailing list archive at Nabble.com.

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



Re: tapestry, hibernate and timeout

2011-11-28 Thread bdm
Thanks for your reply ! 
I already set a c3p0 connection pool but I missed the idleTestPeriod param !
I try that and get back tomorrow !

See you!

--
View this message in context: 
http://tapestry.1045711.n5.nabble.com/tapestry-hibernate-and-timeout-tp5028844p5029204.html
Sent from the Tapestry - User mailing list archive at Nabble.com.

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



Re: tapestry, hibernate and timeout

2011-11-28 Thread nquirynen
I think this is a MySQL / Hibernate issue, not Tapestry.

I think you need to configure your connection pooling. Example:

http://community.jboss.org/wiki/HowToConfigureTheC3P0ConnectionPool
http://community.jboss.org/wiki/HowToConfigureTheC3P0ConnectionPool 

--
View this message in context: 
http://tapestry.1045711.n5.nabble.com/tapestry-hibernate-and-timeout-tp5028844p5029121.html
Sent from the Tapestry - User mailing list archive at Nabble.com.

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