This is correct.
The <local-tx-datasource> will automatically set the auto commit value of the
connection to false depending upon the context of the global transaction. Typically, there
is no reason for you to use this datasource *and* set the auto commit value yourself. If
you want to use this datasource outside of the context of a global transaction you can
simply aquire the connection and set the value yourself. Note, this is not really the way
this data source is intended for use. As a result, you have a few options:
1) Use the <no-tx-datasource>. Use of this datasource will put the responsiblity of
the transaction on you. After acquiring the DataSource you will want to do the
setAutoCommit(false), do your JDBC work, and then commit. This type of datasource funtions
much like a non-managed datasource running outside of the application server though you
still get pooling, can leverage security etc. With you particular config, you can do this
simply by renaming the
| <local-tx-datasource>
|
| to
|
| <no-tx-datasource>
|
|
|
and remove the auto commit property.
2) Start a global transaction in your WebApplication via the UserTransaction object bound
into JNDI to scope the work you want your JDBC connection to be enlisted in. See the JTA
spec for examples.
3) Use EJB(X) and leverage CMT and declarative transaction management to do all of this
for you.
More on datasource configuration can be found here:
http://wiki.jboss.org/wiki/Wiki.jsp?page=ConfigDataSources
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4016513#...
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&a...