[jboss-user] [JCA/JBoss] - Re: shouldn't local-tx-datasource have auto-commit = false?
jhudson
do-not-reply at jboss.com
Sun Jan 14 12:59:26 EST 2007
Sorry, I should have provided that information before... thanks very much for the reply.
I'm using hibernate 3.1.3 and jboss-4.0.5 with mysql 5.0.11 and the latest connector
| I have a HAR which puts the session factory in the JNDI context
| <server>
| <mbean code="org.jboss.hibernate.jmx.Hibernate" name="jboss.har:service=Hibernate">
| <depends>jboss.jca:service=DataSourceBinding,name=jdbc/MyAdBox</depends>
|
| <attribute name="DatasourceName">java:/jdbc/MyAdBox</attribute>
| <attribute name="SessionFactoryName">java:/hibernate/MyAdBoxHibernateFactory2</attribute>
| <attribute name="CacheProviderClass">org.hibernate.cache.OSCacheProvider</attribute>
| <attribute name="Dialect">org.hibernate.dialect.MySQLDialect</attribute>
| <attribute name="QueryCacheEnabled">true</attribute>
| <attribute name="ShowSqlEnabled">false</attribute>
| </mbean>
| </server>
And, this is how I would handle a transaction...
Session s = null;
| Transaction t = null;
| try {
| s = getSession();
| t = s.beginTransaction()
|
| // transactional code here
|
| t.commit();
| }
| catch (Throwable throwable) {
| if (null != t) t.rollback();
| }
| finally {
| if (null != s) s.close();
| }
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4001546#4001546
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4001546
More information about the jboss-user
mailing list