On a book i read the following example (at the bottom). I imported it in a jar than run with
jboss.
The error on interroga(
String str) method is:
ON CLIENT
java.sql.SQLException: Connection handle has been closed and is unusable
ON SERVER
[CachedConnectionManager] Closing a connection for you. Please close them yourself: org.jboss.resource.adapter.jdbc.WrappedConnection@594680
The problem is the that is in the apriConnessione() i got a call for make a db connection. This one is activated fist from ejbActivate(); then jboss close automatically connection without a ejbPassivate(). Then i enter in Interroga() method and the connection is no more avaible giving me exception.
I read the FAQ , expecially
http://www.jboss.org/wiki/Wiki.jsp?page=WhatDoesTheMessageDoYourOwnHousekeepingMean and so i correct the exercise putting alla connection statemente in the method interroga():
In this case the program has no error.
BUT
I do not understand the beaviour of jboss because i studied that in ejbPassivate / ejbActivate i must close connections; not in every method!
Reading the FAQ i understand that i must open & close connection in every method.
Can you explain me why? .. or what i misunderstand
thankyou, Bye