Changeset 28 for trunk/fmgVen/etc


Ignore:
Timestamp:
Feb 9, 2011, 10:53:45 PM (14 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/etc/test-db/test-db-changelog.xml

    r27 r28  
    1515            <column name="description" type="TEXT(2147483647)"/> 
    1616            <column name="date" type="TIMESTAMP WITHOUT TIME ZONE"/> 
     17            <column name="another_domain_object_id" type="int"/> 
    1718        </createTable> 
    1819    </changeSet> 
    1920    <changeSet author="fmguler" id="2"> 
    20         <tagDatabase tag="tag-single-table"/> 
     21        <createTable schemaName="public" tableName="another_domain_object"> 
     22            <column autoIncrement="true" name="id" type="serial"> 
     23                <constraints nullable="false" primaryKey="true" primaryKeyName="another_domain_object_pkey"/> 
     24            </column> 
     25            <column name="name" type="VARCHAR(100)"/> 
     26            <column name="description" type="TEXT(2147483647)"/> 
     27            <column name="date" type="TIMESTAMP WITHOUT TIME ZONE"/> 
     28            <column name="some_domain_object_id" type="int"/> 
     29        </createTable> 
    2130    </changeSet> 
    2231    <changeSet author="fmguler" id="3"> 
     32        <tagDatabase tag="tag-no-data"/> 
     33    </changeSet> 
     34    <changeSet author="fmguler" id="4"> 
    2335        <insert schemaName="public" tableName="some_domain_object"> 
    24             <column name="id" value="1"/> 
    25             <column name="name" value="name1"/> 
    26             <column name="description" value="desc1"/> 
     36            <column name="name" value="sdo1"/> 
     37            <column name="description" value="sdo desc1"/> 
    2738            <column name="date" value="2010-10-13"/> 
     39            <column name="another_domain_object_id" value="1"/> 
    2840        </insert> 
    2941        <rollback> 
     
    3143        </rollback> 
    3244    </changeSet> 
    33     <changeSet author="fmguler" id="4"> 
    34         <tagDatabase tag="tag-single-table-data"/> 
     45    <changeSet author="fmguler" id="5"> 
     46        <insert schemaName="public" tableName="another_domain_object"> 
     47            <column name="name" value="ado1"/> 
     48            <column name="description" value="ado desc1"/> 
     49            <column name="date" value="2011-01-19"/> 
     50            <column name="some_domain_object_id" value="1"/> 
     51        </insert> 
     52        <insert schemaName="public" tableName="another_domain_object"> 
     53            <column name="name" value="ado2"/> 
     54            <column name="description" value="ado desc2"/> 
     55            <column name="date" value="2011-02-09"/> 
     56            <column name="some_domain_object_id" value="1"/> 
     57        </insert> 
     58        <rollback> 
     59            delete from another_domain_object; 
     60        </rollback> 
     61    </changeSet> 
     62    <changeSet author="fmguler" id="6"> 
     63        <tagDatabase tag="tag-data"/> 
    3564    </changeSet> 
    3665    <!-- << TEST SCHEMA --> 
Note: See TracChangeset for help on using the changeset viewer.