Hi,


In Eclipse 3.4 (not sure about the previous version), I have a project, in 
the src, there is a interface file called "DatabaseCommand.java". This file 
is an interface file.

It s content is shown below:

package command;

import java.sql.Connection;
import java.sql.SQLException;

public interface DatabaseCommand {
    public Object executeDatabaseOperation(Connection conn) throws 
SQLException ;
}





Another file CreateOrder.java *implements* this interface.

Its content shown as below:



Package command;

import java.sql.Connection;
import java.sql.SQLException;
import java.sql.Statement;
import java.sql.ResultSet;
import java.util.ArrayList;
import domain.Customer;

/**
 * List existing customers in the database
 */

public class ListCustomers implements DatabaseCommand {

    public Object executeDatabaseOperation(Connection conn) throws 
SQLException {
        // List customers in the database
        
        ArrayList<Customer> list = new ArrayList<Customer>();
        Statement sta = conn.createStatement();
        ResultSet rs = sta.executeQuery("SELECT ID, FIRST_NAME, 
LAST_NAME, ADDRESS FROM CUSTOMER");
        while(rs.next()) {
            Customer cust = new Customer();
            cust.setId(rs.getInt(1));
            cust.setFirstName(rs.getString(2));
            cust.setLastName(rs.getString(3));
            cust.setAddress(rs.getString(4));
            list.add(cust);
        }
        
        rs.close();
        sta.close();
        
        return list;
    }
}



When I press Clt-B to build the project(All), DatabaseCommand.java does not 
get compiled, no DatabaseCommand.class generated in the 
build\classes\command\ directory. The syntax highlithed in the 
CreateOrder.java file indicated that DatabaseCommand is an unknown type, 
that meant no class found.



How can I get around this issue? may be I should ask how to generate an 
interface dot class file (eg. DatabaseCommand.class in this instance)?



Thanks

Sam


Reply via email to