use of java.sql.Savepoint in project opentheso by miledrousset.
the class RelationsHelper method setRelationMT.
/**
* Cette fonction permet d'ajouter une relation MT ou domaine à un concept
*
* @param conn
* @param idConcept
* @param idGroup
* @param idThesaurus
* @return boolean
*/
public boolean setRelationMT(Connection conn, String idConcept, String idGroup, String idThesaurus) {
Statement stmt;
boolean status = false;
String query;
Savepoint savepoint = null;
try {
// Get connection from pool
savepoint = conn.setSavepoint();
try {
stmt = conn.createStatement();
try {
/* if (!new RelationsHelper().addRelationHistorique(conn, idConcept, idThesaurus, idConcept, "TT", idUser, "DEL")) {
return false;
}*/
query = "UPDATE concept_group_concept set" + " idgroup = '" + idGroup + "'" + " WHERE idconcept ='" + idConcept + "'" + " AND idthesaurus = '" + idThesaurus + "'";
stmt.executeUpdate(query);
status = true;
} finally {
stmt.close();
}
} finally {
// conn.close();
}
} catch (SQLException sqle) {
// Log exception
if (sqle.getSQLState().equalsIgnoreCase("23505")) {
try {
if (savepoint != null) {
conn.rollback(savepoint);
status = true;
}
} catch (SQLException ex) {
Logger.getLogger(RelationsHelper.class.getName()).log(Level.SEVERE, null, ex);
}
} else {
log.error("Error while deleting relation Group for Concept : " + idConcept, sqle);
}
}
return status;
}
use of java.sql.Savepoint in project spanner-jdbc by olavloite.
the class AbstractCloudSpannerConnectionTest method testRollback.
@Test
public void testRollback() throws Exception {
thrown.expect(SQLFeatureNotSupportedException.class);
AbstractCloudSpannerConnection testSubject;
Savepoint savepoint = null;
// default test
testSubject = createTestSubject();
testSubject.rollback(savepoint);
}
Aggregations