Hibernate 3.0.5, JBoss 3.2.6
After reading this page,(
http://hibernate.org/42.html), I have a few questions.
When implementing a session-per-request pattern in an BMT-EJB, why should I use "transaction demarcation with JTA" as opposed to "transaction demarcation with plain JDBC"? Will not using JTA have adverse effect on the datasource's manager, or something like that?
The page above says: "note that you should use JTA and a transaction-bound strategy in a JEE environment" and that "each Datasource you use in such a container is automatically handled by a JTA TransactionManager", but doesn't really say much else as to <b>why</b> you should use JTA trans over JDBC trans in JEE.
I have no problem using JTA, but I dont' want to use just because it's there. My persistence code only talks to one DB and is not distributed in any way. JTA seems like overkill. All I really need is the app server to pool the DB connections for Hibernate.
I ask, not to be difficult, but because I am doing this:
UserTransaction tx = (UserTransaction)new InitialContext()
.lookup("java:comp/UserTransaction");
like in the example, and became worried when I read this:
"For BMT beans, do not obtain the UserTransaction interface using a JNDI lookup. Doing this violates the EJB specification, and the returned UserTransaction object does not have the hooks the EJB container needs to make important checks."
(
http://docs.jboss.com/jbossas/admindeve ... chapt.html)
Now I'm thinking maybe JDBC Tx would be safer.
Basically I need to decide which is worse, not using JTA in a BMT-EJB, or looking up the UserTransaction in a way that violate the EJB spec.
Any offerings of insight would be greatly appreciated.