Changeset 27 for trunk/fmgVen/src/com/fmguler/ven/Ven.java
- Timestamp:
- Jan 16, 2011, 10:00:07 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/fmgVen/src/com/fmguler/ven/Ven.java
r26 r27 20 20 import java.util.HashMap; 21 21 import java.util.List; 22 import java.util.Map; 22 23 import javax.sql.DataSource; 23 24 import org.springframework.beans.BeanWrapper; … … 54 55 55 56 /** 56 * Save the object. If it has a "id" property it will be updated.57 * Save the object. If it has a non null (or non zero) "id" property it will be updated. 57 58 * It will be inserted otherwise. 58 59 * <p> … … 78 79 } 79 80 81 /** 82 * Delete the the object with the specified id of the specified objectClass type 83 * @param id the id of the object to be deleted 84 * @param objectClass the class of the object to be deleted 85 */ 80 86 public void delete(int id, Class objectClass) { 87 String query = generator.generateDeleteQuery(objectClass); 88 Map parameterMap = new HashMap(); 89 parameterMap.put("id", new Integer(id)); 90 template.update(query, parameterMap); 81 91 } 82 92 … … 86 96 private boolean isObjectNew(Object object) throws VenException { 87 97 BeanWrapper beanWrapper = new BeanWrapperImpl(object); 88 Object objectId = beanWrapper.getPropertyValue("id"); 98 Object objectId = beanWrapper.getPropertyValue("id"); 89 99 if (objectId == null) return true; 90 100 if (!(objectId instanceof Integer)) throw new VenException(VenException.EC_GENERATOR_OBJECT_ID_TYPE_INVALID);
Note: See TracChangeset
for help on using the changeset viewer.