Q:

Unit tests for database queries

How to write test cases for the class below. It checks for values of the given query in a database. 
public class DboQueryCheck {
    public static void main(String[] args) {
        // TODO Auto-generated method stub
        System.out.println("Start DboDaoService");
        DboDaoService dboDaoServcice = new DboDaoService();
        dboDaoServcice.build();
        String query = " select o.org_name,  l.organization_id from " +
                       " code_value cv,code_value cv_loc,code_value_outbound cvo,location l,organization o" +
                       " where " + 
                       " (cv.cdf_meaning = 'INGENI' or cv.cdf_meaning = 'MEDNEC')" +
                       " and cvo.contributor_source_cd = cv.code_value" +
                       " and cvo.alias_type_meaning = 'FACILITY'" +
                       " and l.location_cd = cvo.code_value" +
                       " and cv_loc.code_value = l.location_cd" + 
                       " and cv_loc.code_set = 220" +
                       " and o.organization_id = l.organization_id" + 
                       " order by o.org_name, cv_loc.display, cv.cdf_meaning";

        System.out.println();
        dboDaoServcice.report(query);

    }
}

A:

You don't. In your example, you are testing more than just a unit. Therefor, by definition, you cannot 'unit' test this. If you want to test this, at least consider using DBUnit or an in memory database like H2/HSQLDB database.
Alternatively, you could test the generated SQL commands, but I wonder what the value of that would be.

