当前位置: 首页>>代码示例>>Java>>正文


Java IContext.endTransaction方法代码示例

本文整理汇总了Java中com.mendix.systemwideinterfaces.core.IContext.endTransaction方法的典型用法代码示例。如果您正苦于以下问题:Java IContext.endTransaction方法的具体用法?Java IContext.endTransaction怎么用?Java IContext.endTransaction使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.mendix.systemwideinterfaces.core.IContext的用法示例。


在下文中一共展示了IContext.endTransaction方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: findOrCreateSynchronized

import com.mendix.systemwideinterfaces.core.IContext; //导入方法依赖的package包/类
public T findOrCreateSynchronized(Object... keysAndValues) throws CoreException, InterruptedException {
	T res = findFirst(keysAndValues);
	
	if (res != null) {
		return res;
	} else {
		synchronized (Core.getMetaObject(entity)) {
			IContext synchronizedContext = context.getSession().createContext().createSudoClone();
			try {
				synchronizedContext.startTransaction();
				res = createProxy(synchronizedContext, proxyClass, XPath.create(synchronizedContext, entity).findOrCreate(keysAndValues));
				synchronizedContext.endTransaction();
				return res;
			} catch (CoreException e) {
				if (synchronizedContext.isInTransaction()) {
					synchronizedContext.rollbackTransAction();
				}
				throw e;
			}
		}
	}
}
 
开发者ID:mendix,项目名称:database-connector,代码行数:23,代码来源:XPath.java

示例2: getSessionFor

import com.mendix.systemwideinterfaces.core.IContext; //导入方法依赖的package包/类
private static ISession getSessionFor(IContext context, String username) {
	ISession session  = Core.getActiveSession(username);
	
	if (session == null) {
		IContext newContext = context.getSession().createContext().getSudoContext();
		newContext.startTransaction();
		try {
			session = initializeSessionForUser(newContext, username);
		} catch (CoreException e) {
			newContext.rollbackTransAction();
			
			throw new RuntimeException("Failed to initialize session for user: " + username + ": " + e.getMessage(), e);
		} finally {
			newContext.endTransaction();
		}
	}
	
	return session;
}
 
开发者ID:appronto,项目名称:RedisConnector,代码行数:20,代码来源:Misc.java

示例3: findOrCreateSynchronized

import com.mendix.systemwideinterfaces.core.IContext; //导入方法依赖的package包/类
public T findOrCreateSynchronized(Object... keysAndValues) throws CoreException, InterruptedException {
	T res = findFirst(keysAndValues);
	
	if (res != null) {
		return res;
	} else {
		synchronized (Core.getMetaObject(entity)) {
			IContext synchronizedContext = context.getSession().createContext().getSudoContext();
			try {
				synchronizedContext.startTransaction();
				res = createProxy(synchronizedContext, proxyClass, XPath.create(synchronizedContext, entity).findOrCreate(keysAndValues));
				synchronizedContext.endTransaction();
				return res;
			} catch (CoreException e) {
				if (synchronizedContext.isInTransaction()) {
					synchronizedContext.rollbackTransAction();
				}
				throw e;
			}
		}
	}
}
 
开发者ID:appronto,项目名称:RedisConnector,代码行数:23,代码来源:XPath.java

示例4: executeAction

import com.mendix.systemwideinterfaces.core.IContext; //导入方法依赖的package包/类
@Override
public java.lang.Boolean executeAction() throws Exception
{
	// BEGIN USER CODE
	ISession session = getContext().getSession();
	IContext newContext = session.createContext();
	Core.commit(newContext, mxObject);
	newContext.endTransaction();
	return true;
	// END USER CODE
}
 
开发者ID:ako,项目名称:MqttClient,代码行数:12,代码来源:commitInSeparateDatabaseTransaction.java

示例5: executeAction

import com.mendix.systemwideinterfaces.core.IContext; //导入方法依赖的package包/类
@Override
public Boolean executeAction() throws Exception
{
	// BEGIN USER CODE
	ISession session = getContext().getSession();
	IContext newContext = session.createContext();
	Core.commit(newContext, mxObject);
	newContext.endTransaction();
	return true;
	// END USER CODE
}
 
开发者ID:appronto,项目名称:RedisConnector,代码行数:12,代码来源:commitInSeparateDatabaseTransaction.java

示例6: executeAction

import com.mendix.systemwideinterfaces.core.IContext; //导入方法依赖的package包/类
@Override
public java.lang.Boolean executeAction() throws Exception
{
	// BEGIN USER CODE
	ISession session = getContext().getSession();
	IContext newContext = session.createContext();
	Core.delete(newContext, objectList);
	newContext.endTransaction();
	return true;
	// END USER CODE
}
 
开发者ID:ako,项目名称:MqttClient,代码行数:12,代码来源:deleteInSeparateTransaction.java


注:本文中的com.mendix.systemwideinterfaces.core.IContext.endTransaction方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。