Search in sources :

Example 1 with Session

use of com.baidu.hugegraph.backend.store.mysql.MysqlSessions.Session in project incubator-hugegraph by apache.

the class MysqlStore method mutate.

@Override
public void mutate(BackendMutation mutation) {
    if (LOG.isDebugEnabled()) {
        LOG.debug("Store {} mutation: {}", this.store, mutation);
    }
    this.checkOpened();
    Session session = this.sessions.session();
    for (Iterator<BackendAction> it = mutation.mutation(); it.hasNext(); ) {
        this.mutate(session, it.next());
    }
}
Also used : BackendAction(com.baidu.hugegraph.backend.store.BackendAction) Session(com.baidu.hugegraph.backend.store.mysql.MysqlSessions.Session)

Example 2 with Session

use of com.baidu.hugegraph.backend.store.mysql.MysqlSessions.Session in project incubator-hugegraph by apache.

the class MysqlStore method rollbackTx.

@Override
public void rollbackTx() {
    this.checkOpened();
    Session session = this.sessions.session();
    session.rollback();
}
Also used : Session(com.baidu.hugegraph.backend.store.mysql.MysqlSessions.Session)

Example 3 with Session

use of com.baidu.hugegraph.backend.store.mysql.MysqlSessions.Session in project incubator-hugegraph by apache.

the class MysqlStore method beginTx.

@Override
public void beginTx() {
    this.checkOpened();
    Session session = this.sessions.session();
    try {
        session.begin();
    } catch (SQLException e) {
        throw new BackendException("Failed to open transaction", e);
    }
}
Also used : SQLException(java.sql.SQLException) Session(com.baidu.hugegraph.backend.store.mysql.MysqlSessions.Session) BackendException(com.baidu.hugegraph.backend.BackendException)

Example 4 with Session

use of com.baidu.hugegraph.backend.store.mysql.MysqlSessions.Session in project incubator-hugegraph by apache.

the class MysqlStore method commitTx.

@Override
public void commitTx() {
    this.checkOpened();
    Session session = this.sessions.session();
    int count = session.commit();
    if (LOG.isDebugEnabled()) {
        LOG.debug("Store {} committed {} items", this.store, count);
    }
}
Also used : Session(com.baidu.hugegraph.backend.store.mysql.MysqlSessions.Session)

Aggregations

Session (com.baidu.hugegraph.backend.store.mysql.MysqlSessions.Session)4 BackendException (com.baidu.hugegraph.backend.BackendException)1 BackendAction (com.baidu.hugegraph.backend.store.BackendAction)1 SQLException (java.sql.SQLException)1