import java.util.List;
import java.util.ResourceBundle;
-import org.hibernate.HibernateException;
-import org.hibernate.Session;
-import org.hibernate.Transaction;
-import org.splat.dal.dao.som.Database;
import org.splat.dal.bo.som.Scenario;
import org.splat.dal.bo.som.SimulationContext;
import org.splat.dal.bo.som.SimulationContextType;
}
public String doCreate() throws Exception {
- // -------------------------
String[] input = context.split(",");
int valid = Integer.valueOf(input[0]);
String value = ""; // input[1] if exists
- Session session = Database.getSession();
- Transaction transax = session.beginTransaction();
Study.Properties sprop = new Study.Properties();
// Check arguments and creation of the study
.selectType("product");
contelm = getSimulationContextService()
.selectSimulationContextsWhere(cprop.setType(product));
- transax.commit();
return INPUT; // Title empty, simply wait for input without error message
}
try {
// Update of the session
number += 1;
open(study); // Opens the study,
- transax.commit();
return SUCCESS;
} catch (Exception error) {
logger.error("Unable to save the study, reason:", error);
- if (transax != null && transax.isActive()) {
- // Second try-catch as the rollback could fail as well
- try {
- transax.rollback();
- } catch (HibernateException backerror) {
- logger.debug("Error rolling back transaction", backerror);
- }
- }
return ERROR;
}
}