source: trunk/fmgVen/test/com/fmguler/ven/sample/domain/AnotherDomainObject.java @ 28

Last change on this file since 28 was 28, checked in by fmguler, 13 years ago

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 size: 2.5 KB
Line 
1/*
2 *  fmgVen - A Convention over Configuration Java ORM Tool
3 *  Copyright 2011 Fatih Mehmet Güler
4 *
5 *  Licensed under the Apache License, Version 2.0 (the "License");
6 *  you may not use this file except in compliance with the License.
7 *  You may obtain a copy of the License at
8 *
9 *       http://www.apache.org/licenses/LICENSE-2.0
10 *
11 *  Unless required by applicable law or agreed to in writing, software
12 *  distributed under the License is distributed on an "AS IS" BASIS,
13 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 *  See the License for the specific language governing permissions and
15 *  limitations under the License.
16 *  under the License.
17 */
18package com.fmguler.ven.sample.domain;
19
20import java.util.Date;
21
22/**
23 *
24 * @author Fatih Mehmet Güler
25 */
26public class AnotherDomainObject {
27    private Integer id;
28    private String name;
29    private String description;
30    private Date date;
31    private SomeDomainObject someDomainObject;
32
33    /**
34     * @return the id
35     */
36    public Integer getId() {
37        return id;
38    }
39
40    /**
41     * @param id the id to set
42     */
43    public void setId(Integer id) {
44        this.id = id;
45    }
46
47    /**
48     * @return the name
49     */
50    public String getName() {
51        return name;
52    }
53
54    /**
55     * @param name the name to set
56     */
57    public void setName(String name) {
58        this.name = name;
59    }
60
61    /**
62     * @return the description
63     */
64    public String getDescription() {
65        return description;
66    }
67
68    /**
69     * @param description the description to set
70     */
71    public void setDescription(String description) {
72        this.description = description;
73    }
74
75    /**
76     * @return the date
77     */
78    public Date getDate() {
79        return date;
80    }
81
82    /**
83     * @param date the date to set
84     */
85    public void setDate(Date date) {
86        this.date = date;
87    }
88
89    /**
90     * @return the someDomainObject
91     */
92    public SomeDomainObject getSomeDomainObject() {
93        return someDomainObject;
94    }
95
96    /**
97     * @param someDomainObject the someDomainObject to set
98     */
99    public void setSomeDomainObject(SomeDomainObject someDomainObject) {
100        this.someDomainObject = someDomainObject;
101    }
102
103    public String toString() {
104        return id + " " + name + " " + description + " some domain object: {" + someDomainObject + "}";
105    }
106}
Note: See TracBrowser for help on using the repository browser.