Steve Magoun wrote:

> Obtaining a connection in setEntityContext and releasing it in
> unsetEntityContext is usually a bad thing to do for exactly that reason
> - the beans are almost always pooled. Read Tip #7 (at the bottom) from
> http://www.flashline.com/content/bq/bq080200.jsp; it does a pretty good
> job of explaining where you should obtain database connections, and why.

I don't think that advice is strictly accurate.  In theory, the 
container is quite capable of performing its pooling duties even if 
beans retain references to connections across methods.  This is because 
the container knows when a method is executing and also has complete 
control over the connection it's using.

However, currently JBoss doesn't implement this kind of thing properly, 
so it definitely *is* a good idea to close connections as soon as 
possible when using JBoss.  I hope to fix this at some point, unless 
someone beats me to it.


> The rest of the article is pretty good, too....

I haven't read it, but if Tip #7 is anything to go by, take the rest 
with a grain of salt.

Toby.


_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to