[jboss-user] [JCA/JBoss] - Re: Keep the connection alive after a management bean method
wimxa
do-not-reply at jboss.com
Mon Nov 17 18:02:59 EST 2008
Peter, here is the pseudo-snippet that should answer your questions about how the things are right now:
@Service(objectName = "MyServer:service=MyManagement")
@Management(MyManagement.class)
@TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED)
public class MyManagementBean implements MyManagement {
@Resource(mappedName = "java:/MY_DATA_SOURCE")
private DataSource dataSource;
private LegacyClass legacyObject;
public void doSomething() {
Connection dbConnection = dataSource.getConnection();
if(this.legacyObject == null || dbConnection.isClosed()) {
this.legacyObject = new LegacyClass(dbConnection, ...);
}
legacyObject.legacyDoSomething();
// ...
// I don't close the connection
}
// ...
}
I get the message in question after doSomething exits. If I understood you correctly, this is not a good way, since I am using a DataSource, correct? I.e. the only option is not using DataSources, but JDBC directly. JBoss will always forcibly close the connection. Is there some parameter that I can tweak this with?
If this is not possible, is there a simple way to get the parameters of that DataSource, so I can use them to make the connection myself? I would like to avoid storing the username, password, URL, etc. in my code directly.
Thanks again for your help!
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4189937#4189937
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4189937
More information about the jboss-user
mailing list