DAO Medge Code Examples
Back to the Main Page

Default Order By

package au.id.medge.daotester.testsuite;

import au.id.medge.dao.utilities.DAOException;
import au.id.medge.tutorial.Celebrity;
import au.id.medge.tutorial.CelebrityGroup;
import java.sql.SQLException;
import java.util.List;

public class DefaultOrderByTest extends AbstractTestSuite {

    public DefaultOrderByTest() {
        super("Default Order By");
    }

    private void loadCelebrities() {
        try {
            List celebrities = getDAO().select(Celebrity.class);
            for (Celebrity celebrity : celebrities) {
                System.out.println(celebrity.getCelebritySurname());
                List groups = celebrity.getCelebrityGroup();
                for (CelebrityGroup group : groups) {
                    System.out.println("\t" + group.getGroupName());
                }
            }
        } catch (DAOException | SQLException ex) {
            reportFailure("Can't load celebrities", ex);
        }
    }

    @Override
    public void runTestSuite() {
        loadCelebrities();
    }

}
Back to the Main Page