@@ -0,0 +1,1438 @@
+package db;%0A%0Aimport java.sql.ResultSet;%0Aimport java.sql.SQLException;%0A%0A/**%0A * Created by audun on 9/26/14.%0A */%0Apublic class DBManager extends DBConnector %7B%0A    private double temperature = 0.0;%0A    private int lighting;%0A    private int pressure;%0A    private int humidity;%0A    private int sound;%0A    private int sensorID;%0A%0A    /*%0A     * A database connection is available through the inherited field 'connection'.%0A     */%0A%0A    public double getTemperature()%7B%0A        String query =  %22SELECT Value FROM TemperatureSample JOIN (%22 +%0A                %22SELECT MAX(Date) as MaxDate FROM TemperatureSample AS T1%22 +%0A                %22) AS T2 WHERE Date = MaxDate%22;%0A%0A        try %7B%0A            preparedStatement = connection.prepareStatement(query);%0A            preparedStatement.execute();%0A            ResultSet results = preparedStatement.getResultSet();%0A            results.next();%0A            temperature = results.getDouble(1);%0A        %7D catch (SQLException e) %7B%0A            e.printStackTrace();%0A        %7D%0A%0A        return temperature;%0A    %7D%0A%0A    public int getLighting()%7B return lighting;%7D%0A%0A    public int getPressure()%7Breturn pressure;%7D%0A%0A    public int getHumidity()%7Breturn humidity;%7D%0A%0A    public int getSound()%7Breturn sound;%7D%0A%0A    public int getSensorID()%7Breturn sensorID;%7D%0A%0A    public static void main(String%5B%5D args)%7B%0A        DBManager ctrl = new DBManager();%0A        ctrl.connect();%0A        System.out.println(ctrl.getTemperature());%0A    %7D%0A%7D%0A

Move responsibility of SQL queries into DBManager (different branch)