Java源码示例:com.sap.conn.jco.JCoContext
示例1
public BapiQueryResult execute(ErpEndpoint erpEndpoint) throws QueryExecutionException {
BapiQueryResult queryResult = null;
try {
final JCoDestination jCoDestination = JCoDestinationManager.getDestination(erpEndpoint.getDestinationName());
JCoContext.begin(jCoDestination);
queryResult = queryToExecute.execute(erpEndpoint);
handleCommitAndRollback(erpEndpoint, queryResult);
JCoContext.end(jCoDestination);
} catch (JCoException e) {
throw new QueryExecutionException(e.getMessage());
}
return queryResult;
}
示例2
public void begin() throws JCoException {
if (isUseTid()) {
tid=destination.createTID();
log.debug("begin: created SAP TID ["+tid+"]");
} else {
// Use a stateful connection to make commit through BAPI work, this is
// probably not needed when using tid, but haven't found
// documentation on it yet.
JCoContext.begin(destination);
log.debug("begin: stateful connection");
}
}
示例3
public void release() throws JCoException {
if (!isUseTid()) {
// End the stateful connection
JCoContext.end(destination);
log.debug("release: stateful connection");
}
}
示例4
public void begin(final JCoDestination destination) {
JCoContext.begin(destination);
}
示例5
public void end(final JCoDestination destination)
throws JCoException {
JCoContext.end(destination);
}
示例6
public boolean isStateful(final JCoDestination destination) {
return JCoContext.isStateful(destination);
}