读书人

Spring-多个数据库的事宜操作配置(JND

发布时间: 2012-09-05 15:19:34 作者: rapoo

Spring---多个数据库的事务操作配置(JNDI)

一,当有记录需要操作两个以上数据库时,这时就会引发事务问题,,,jndi能解决此类问题

context.xml

?

二,spring中的事务配置

?

?

?

public class JotmFactoryBean implements FactoryBean, DisposableBean {private Current jotmCurrent;private Jotm jotm;public JotmFactoryBean() throws NamingException {// Check for already active JOTM instance.this.jotmCurrent = Current.getCurrent();// If none found, create new local JOTM instance.if (this.jotmCurrent == null) {// Only for use within the current Spring context:// local, not bound to registry.this.jotm = new Jotm(true, false);this.jotmCurrent = Current.getCurrent();}}/** * Set the default transaction timeout for the JOTM instance. * <p>Should only be called for a local JOTM instance, * not when accessing an existing (shared) JOTM instance. */public void setDefaultTimeout(int defaultTimeout) {this.jotmCurrent.setDefaultTimeout(defaultTimeout);}/** * Return the JOTM instance created by this factory bean, if any. * Will be <code>null</code> if an already active JOTM instance is used. * <p>Application code should never need to access this. */public Jotm getJotm() {return this.jotm;}public Object getObject() {return this.jotmCurrent;}public Class getObjectType() {return this.jotmCurrent.getClass();}public boolean isSingleton() {return true;}/** * Stop the local JOTM instance, if created by this FactoryBean. */public void destroy() {if (this.jotm != null) {this.jotm.stop();}}}

?还得加入jotm中相应的一些包..http://androidguy.blog.51cto.com/974126/216454

carol.jar

carol-iiop-delegate.jar

carol-interceptors.jar

howl.jar

jotm.jar

xapool.jar

?

读书人网 >其他数据库

热点推荐