Short answer - you should not mess with the connection. Use some kind of transaction management that is available for your application server. You can use Bean Managed transactions if you want and you can also use Spring's transaction framework to demarcate your transactions. I can't see any good reasons for manipulating the connection in an EJB environment.
Here is an example of a transaction setup where the methods in the target class are all executed within a new transaction.
Code:
<!-- transaction manager -->
<bean id="transactionManager" class="org.springframework.transaction.jta.JtaTransactionManager">
<property name="transactionManagerName">
<value>javax.transaction.TransactionManager</value>
</property>
</bean>
<!-- factory bean with all methods executed in new transaction. -->
<bean id="senderNewTx" class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean">
<property name="transactionManager">
</property>
<property name="target">
<bean class="org.buggybean.MyTargetClass"/>
</property>
<property name="transactionAttributes">
<props>
<prop key="*">PROPAGATION_REQUIRES_NEW</prop>
</props>
</property>
</bean>
Having said that, if you really need the Connection you can use
Code:
jdbcTemplate.getDataSource().getConnection()
to get hold of the COnnection object.