Ignore:
Timestamp:
Jan 16, 2011, 10:00:07 PM (13 years ago)
Author:
fmguler
Message:

Refs #3 - Ven.delete() is converted to the new format. Missing javadocs are entered.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/fmgVen/src/com/fmguler/ven/Ven.java

    r26 r27  
    2020import java.util.HashMap; 
    2121import java.util.List; 
     22import java.util.Map; 
    2223import javax.sql.DataSource; 
    2324import org.springframework.beans.BeanWrapper; 
     
    5455 
    5556    /** 
    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. 
    5758     * It will be inserted otherwise. 
    5859     * <p> 
     
    7879    } 
    7980 
     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     */ 
    8086    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); 
    8191    } 
    8292 
     
    8696    private boolean isObjectNew(Object object) throws VenException { 
    8797        BeanWrapper beanWrapper = new BeanWrapperImpl(object); 
    88         Object objectId = beanWrapper.getPropertyValue("id");  
     98        Object objectId = beanWrapper.getPropertyValue("id"); 
    8999        if (objectId == null) return true; 
    90100        if (!(objectId instanceof Integer)) throw new VenException(VenException.EC_GENERATOR_OBJECT_ID_TYPE_INVALID); 
Note: See TracChangeset for help on using the changeset viewer.