Ignore:
Timestamp:
Feb 9, 2011, 10:53:45 PM (13 years ago)
Author:
fmguler
Message:

Refs #3 - Ven.get() is converted to the new format. QueryGenerator and QueryMapper are mostly OK, generateRecursively and mapRecursively are converted and checked. Handles joins (includes/associations) many to one and one to many. For one to many, the reverse join field can be determined in a couple of ways. First way is (prefereed) having VenList as the list implementation which specifies the element class and the join field. Second way is using Java 1.5 generic type to detect element class (not yet implemented) and guessing join field by convention (if multiple joins exist, this won't work). The last way is to have some kind of annotation or configuration, which is of course the least preferred way. VenList has a static method to determine the element class in the object list, which currently calls getElementClass if the list is an instance of VenList. In the future other options can be implemented.

Getting object using joins (includes/associations) are tested using dummy assocations between SomeDomainObject and AnotherDomainObject. The Sample class builds the database, tests the operations and rolls back to the initial state. Database refactoring operations are moved to the LiquibaseUtil for clarity.

In the future, the generated queries will be shortened using hashed aliases, and the criteria subsystem will be implemented.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/fmgVen/test/com/fmguler/ven/sample/domain/SomeDomainObject.java

    r26 r28  
    1818package com.fmguler.ven.sample.domain; 
    1919 
     20import com.fmguler.ven.util.VenList; 
    2021import java.util.Date; 
     22import java.util.List; 
    2123 
    2224/** 
     
    2931    private String description; 
    3032    private Date date; 
     33    private List anotherDomainObjects = new VenList(AnotherDomainObject.class, "someDomainObject"); 
     34    private AnotherDomainObject anotherDomainObject = new AnotherDomainObject(); 
    3135 
    3236    /** 
     
    8690    } 
    8791 
     92    /** 
     93     * @return the list of AnotherDomainObject 
     94     */ 
     95    public List getAnotherDomainObjects() { 
     96        return anotherDomainObjects; 
     97    } 
     98 
     99    /** 
     100     * @return the anotherDomainObject 
     101     */ 
     102    public AnotherDomainObject getAnotherDomainObject() { 
     103        return anotherDomainObject; 
     104    } 
     105 
     106    /** 
     107     * @param anotherDomainObject the anotherDomainObject to set 
     108     */ 
     109    public void setAnotherDomainObject(AnotherDomainObject anotherDomainObject) { 
     110        this.anotherDomainObject = anotherDomainObject; 
     111    } 
     112 
    88113    public String toString() { 
    89         return id + " " + name + " " + description + " " + date; 
     114        return id + " " + name + " " + description + " another domain object: {" + anotherDomainObject + "} another domain objects:\n" + anotherDomainObjects; 
    90115    } 
    91116} 
Note: See TracChangeset for help on using the changeset viewer.