Example #1
0
  /**
   * Stores the object in the database. If the object is new, it inserts it; otherwise an update is
   * performed. This method is meant to be used as part of a transaction, otherwise use the save()
   * method and the connection details will be handled internally
   *
   * @param con
   * @throws TorqueException
   */
  public void save(Connection con) throws TorqueException {
    if (!alreadyInSave) {
      alreadyInSave = true;

      // If this object has been modified, then save it to the database.
      if (isModified()) {
        if (isNew()) {
          ContactDocPeer.doInsert((ContactDoc) this, con);
          setNew(false);
        } else {
          ContactDocPeer.doUpdate((ContactDoc) this, con);
        }
      }

      alreadyInSave = false;
    }
  }
Example #2
0
 /**
  * Stores the object in the database. If the object is new, it inserts it; otherwise an update is
  * performed.
  *
  * @throws Exception
  */
 public void save() throws Exception {
   save(ContactDocPeer.getMapBuilder().getDatabaseMap().getName());
 }