Ignore:
Timestamp:
Mar 20, 2012, 2:40:52 PM (13 years ago)
Author:
fmguler
Message:

Refs #7 - Implemented orderAsc and orderDesc methods of Criteria. Have been testing these for a while, no problem so far. Added BigDecimal to db classes (Numeric db type). If the column name is "order" it is escaped while insert/update. (This should be done for all db keywords). Fixed missing mapping of one to many assc. (lists) of many to one (object) assc (obj.obj.list).

File:
1 edited

Legend:

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

    r35 r37  
    2121import com.fmguler.ven.util.VenList; 
    2222import java.beans.PropertyDescriptor; 
     23import java.math.BigDecimal; 
    2324import java.sql.ResultSet; 
    2425import java.sql.SQLException; 
     
    5657        this.dbClasses.add(Double.class); 
    5758        this.dbClasses.add(Boolean.class); 
     59        this.dbClasses.add(BigDecimal.class); 
    5860    } 
    5961 
     
    125127                        if (debug) System.out.println("--field not found: " + columnName); 
    126128                    } 
     129                    continue; //if this is a primitive property, it cannot be an object or list 
    127130                } 
    128131 
    129132                //many to one association (object property) 
    130                 if (map && fieldClass.getPackage() != null && domainPackages.contains(fieldClass.getPackage().getName())) { 
     133                if (fieldClass.getPackage() != null && domainPackages.contains(fieldClass.getPackage().getName())) { 
    131134                    if (columns.contains(columnName + "_id")) { 
    132135                        if (debug) System.out.println(">>object is found " + columnName); 
    133136                        List list = new ArrayList(1); //we know there will be single result 
     137                        if (!map) list.add(fieldValue); //otherwise we cannot catch one to many assc. (lists) of many to one (object) assc. 
    134138                        mapRecursively(rs, columns, columnName, fieldClass, list); 
    135139                        if (list.size() > 0) wr.setPropertyValue(pd.getName(), list.get(0)); 
     
    151155            } 
    152156        } catch (Exception ex) { 
     157            System.out.println("Ven - error while mapping row, table: " + tableName + " object class: " + objectClass + " error: " + ex.getMessage()); 
    153158            if (debug) { 
    154                 System.out.println("Ven - error while mapping row; "); 
    155159                ex.printStackTrace(); 
    156160            } 
Note: See TracChangeset for help on using the changeset viewer.