public FormDetail createForm(FormDetail formDetail) throws FormsOnlineDatabaseException {
    Connection con = getConnection();
    try (PreparedStatement stmt = con.prepareStatement(QUERY_INSERT_FORM)) {
      int id = DBUtil.getNextId(FORMS_TABLENAME, "id");
      stmt.setInt(1, id);
      stmt.setString(2, formDetail.getXmlFormName());
      stmt.setString(3, formDetail.getName());
      stmt.setString(4, formDetail.getDescription());
      stmt.setString(5, formDetail.getTitle());
      stmt.setString(6, formDetail.getCreatorId());
      prepareDateStatement(stmt, 7, formDetail.getCreationDate());
      stmt.setInt(8, formDetail.getState());
      stmt.setInt(9, (formDetail.isAlreadyUsed()) ? 1 : 0);
      stmt.setString(10, formDetail.getInstanceId());

      stmt.executeUpdate();
      formDetail.setId(id);

      return formDetail;
    } catch (SQLException se) {
      throw new FormsOnlineDatabaseException(
          "FormsOnlineDAOJdbc.createForm()",
          SilverpeasException.ERROR,
          "formsOnline.INSERTING_FORM_FAILED",
          se);
    } finally {
      freeConnection(con);
    }
  }
 public void updateForm(FormDetail formDetail) throws FormsOnlineDatabaseException {
   Connection con = getConnection();
   try (PreparedStatement stmt = con.prepareStatement(QUERY_UPDATE_FORM)) {
     stmt.setString(1, formDetail.getXmlFormName());
     stmt.setString(2, formDetail.getName());
     stmt.setString(3, formDetail.getDescription());
     stmt.setString(4, formDetail.getTitle());
     stmt.setString(5, formDetail.getCreatorId());
     prepareDateStatement(stmt, 6, formDetail.getCreationDate());
     stmt.setInt(7, formDetail.getState());
     stmt.setInt(8, (formDetail.isAlreadyUsed()) ? 1 : 0);
     stmt.setString(9, formDetail.getInstanceId());
     stmt.setInt(10, formDetail.getId());
     stmt.executeUpdate();
   } catch (SQLException se) {
     throw new FormsOnlineDatabaseException(
         "FormsOnlineDAOJdbc.updateForm()",
         SilverpeasException.ERROR,
         "formsOnline.UPDATE_FORM_FAILED",
         se);
   } finally {
     freeConnection(con);
   }
 }