Example usage for org.apache.ibatis.session SqlSession update

List of usage examples for org.apache.ibatis.session SqlSession update

Introduction

In this page you can find the example usage for org.apache.ibatis.session SqlSession update.

Prototype

int update(String statement, Object parameter);

Source Link

Document

Execute an update statement.

Usage

From source file:org.restcomm.connect.dao.mybatis.MybatisExtensionsConfigurationDao.java

License:Open Source License

@Override
public void updateAccountExtensionConfiguration(ExtensionConfiguration extensionConfiguration, Sid accountSid)
        throws ConfigurationException {
    final SqlSession session = sessions.openSession();
    try {/*from   w  w  w.  j  ava2s .  c  om*/
        if (extensionConfiguration != null && extensionConfiguration.getConfigurationData() != null) {
            if (validate(extensionConfiguration)) {
                final Map<String, Object> map = new HashMap<String, Object>();
                map.put("account_sid", DaoUtils.writeSid(accountSid));
                map.put("extension_sid", DaoUtils.writeSid(extensionConfiguration.getSid()));

                if (extensionConfiguration.getConfigurationData() != null)
                    map.put("configuration_data", extensionConfiguration.getConfigurationData());
                session.update(namespace + "updateAccountExtensionConfiguration", map);
            } else {
                throw new ConfigurationException(
                        "Exception trying to update configuration, validation failed. configuration type: "
                                + extensionConfiguration.getConfigurationType());
            }
        }
        session.commit();
    } finally {
        session.close();
    }
}

From source file:org.restcomm.connect.dao.mybatis.MybatisGeolocationDao.java

License:Open Source License

@Override
public void updateGeolocation(Geolocation gl) {
    final SqlSession session = sessions.openSession();
    try {//from  w w w  . ja va2 s  .  c om
        session.update(namespace + "updateGeolocation", toMap(gl));
        session.commit();
    } finally {
        session.close();
    }
}

From source file:org.restcomm.connect.dao.mybatis.MybatisOrganizationDao.java

License:Open Source License

@Override
public void updateOrganization(Organization organization) {
    final SqlSession session = sessions.openSession();
    try {//from   w  w w.j a va  2s .c  o m
        session.update(namespace + "updateOrganization", toMap(organization));
        session.commit();
    } finally {
        session.close();
    }
}

From source file:org.restcomm.connect.dao.mybatis.MybatisProfileAssociationsDao.java

License:Open Source License

@Override
public void updateProfileAssociationOfTargetSid(ProfileAssociation profileAssociation) {
    final SqlSession session = sessions.openSession();
    try {/*w  ww  .j  av  a 2s. c o m*/
        session.update(namespace + "updateProfileAssociationOfTargetSid", toMap(profileAssociation));
        session.commit();
    } finally {
        session.close();
    }
}

From source file:org.restcomm.connect.dao.mybatis.MybatisProfileAssociationsDao.java

License:Open Source License

@Override
public void updateAssociatedProfileOfAllSuchProfileSid(String oldProfileSid, String newProfileSid) {
    final SqlSession session = sessions.openSession();
    try {/*from  w ww  . j a  v  a 2 s.  c o m*/
        Map<String, Object> map = new HashMap<String, Object>();
        map.put("profile_sid", newProfileSid);
        map.put("old_profile_sid", oldProfileSid);
        session.update(namespace + "updateAssociatedProfileOfAllSuchProfileSid", map);
        session.commit();
        map = null;
    } finally {
        session.close();
    }
}

From source file:org.restcomm.connect.dao.mybatis.MybatisProfilesDao.java

License:Open Source License

@Override
public void updateProfile(Profile profile) {
    final SqlSession session = sessions.openSession();
    try {//ww w.j  a v a 2s. com
        session.update(namespace + "updateProfile", profile);
        session.commit();
    } finally {
        session.close();
    }
}

From source file:org.restcomm.connect.dao.mybatis.MybatisRecordingsDao.java

License:Open Source License

public void updateRecording(final Recording recording) {
    final SqlSession session = sessions.openSession();
    try {/*from   w w  w.  java  2  s.c  om*/
        session.update(namespace + "updateRecording", toMap(recording));
        session.commit();
    } finally {
        session.close();
    }
}

From source file:org.restcomm.sbc.dao.mybatis.MybatisBanListDao.java

License:Open Source License

private void updateBanList(final String selector, final BanList banList) {
    final SqlSession session = sessions.openSession();
    try {//w w w  .ja  va 2  s .  c  o m
        session.update(selector, toMap(banList));
        session.commit();
    } finally {
        session.close();
    }
}

From source file:org.restcomm.sbc.dao.mybatis.MybatisNetworkPointsDao.java

License:Open Source License

private void updateNetworkPoint(final String selector, final NetworkPoint point) {
    final SqlSession session = sessions.openSession();
    try {//from  w ww. java2  s  .  co m
        session.update(selector, toMap(point));
        session.commit();
    } finally {
        session.close();
    }
}

From source file:org.solmix.datax.mybatis.MybatisDataService.java

License:Open Source License

protected DSResponse executeAdd(DSRequest req, SqlSession session) throws DSCallException {
    DSResponse res = new DSResponseImpl(req, Status.STATUS_SUCCESS);
    String statement = getMybatisStatement(req);
    Object value = req.getRawValues();
    int result = session.update(statement, value);
    res.setAffectedRows(new Integer(result));
    res.setRawData(result);//w  w w .  ja v  a 2s  .  c  o m
    return res;
}