本文整理汇总了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;
}
}
}
}
示例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;
}
示例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;
}
}
}
}
示例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
}
示例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
}
示例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
}