DAO Medge Code Examples
Back to the Main Page

Integer as String

Note the number is a string, useful for batch loading

package au.id.medge.daotester.testsuite;

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.utilities.DAOException;
import au.id.medge.tutorial.Absinthe;
import java.sql.SQLException;
import java.util.List;

public class IntegerAsStringTest extends AbstractTestSuite {
    
    public IntegerAsStringTest() {
        super("Integer as string");
    }
    
    public void getAbsinthes() {
        try {
            daotable table = getDAO().getTable(Absinthe.class);
            daoproperty property = getDAO().getProperty(table, "flavour");
            PropertyFilter filter = new PropertyFilter(table, property, Filter.OPERAND.OPERAND_GREATER_THAN_EQUAL, "4");
            List absinthes = getDAO().select(table, filter);
            reportSuccess("Absinthes read " + absinthes.size());
        } catch (DAOException | SQLException ex) {
            reportFailure("Can't load absinthes with integer as string.", ex);
        }
    }
    
    @Override
    public void runTestSuite() {
        getAbsinthes();
    }

}

Back to the Main Page