Back to the Main Page
Selecting from Multiple Tables
package au.id.medge.daotester.testsuite;
import au.id.medge.dao.BaseDatabaseObject;
import au.id.medge.dao.annotations.daoproperty;
import au.id.medge.dao.annotations.daotable;
import au.id.medge.dao.query.Filter;
import au.id.medge.dao.query.PropertyFilter;
import au.id.medge.dao.query.SelectColumn;
import au.id.medge.dao.utilities.DAOException;
import au.id.medge.tutorial.Item;
import au.id.medge.tutorial.ItemLent;
import au.id.medge.tutorial.Person;
import java.sql.SQLException;
import java.text.SimpleDateFormat;
import java.util.List;
import java.util.Map;
public class MultipleTableSelectTests extends AbstractTestSuite {
private final SimpleDateFormat sdf = new SimpleDateFormat("dd-MMM-yyyy HH:mm");
public MultipleTableSelectTests() {
super("Multi-Table");
}
private void testMultiTableBasicPK() {
try {
// Tables involved
daotable tablePerson = getDAO().getTable(Person.class);
daotable tableItem = getDAO().getTable(Item.class);
// Properties to select
daoproperty propertyPersonId = getDAO().getProperty(Person.class, Person.PERSONID);
daoproperty propertyItemId = getDAO().getProperty(Item.class, Item.ITEMID);
// Convert to SelectColumns
SelectColumn selectPersonId = new SelectColumn(tablePerson, propertyPersonId);
SelectColumn selectItemId = new SelectColumn(tableItem, propertyItemId);
List
Back to the Main Page