/** * 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()) { PrestamoPeer.doInsert((Prestamo) this, con); setNew(false); } else { PrestamoPeer.doUpdate((Prestamo) this, con); } } alreadyInSave = false; } }
/** * 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(PrestamoPeer.getMapBuilder().getDatabaseMap().getName()); }