@@ -0,0 +1,1929 @@
+/*%0A * To change this template, choose Tools %7C Templates%0A * and open the template in the editor.%0A */%0A%0A/**%0A *%0A * @author kd%0A */%0Aimport com.vedisoft.ConnectionPool;%0A    import java.sql.*;%0A    import java.util.ArrayList;%0A    import javax.servlet.http.HttpSession;%0A%0Apublic class TokenDAO %7B%0A     ConnectionPool c = null;%0A        Connection conn = null;%0A%0A    public ArrayList%3CToken%3E findAll() %7B%0A        ArrayList%3CToken%3E al = new ArrayList%3CToken%3E();%0A        try %7B%0A            if (c == null) %7B%0A                c = ConnectionPool.getInstance();%0A                c.initialize();%0A            %7D%0A            conn = c.getConnection();%0A            String sql = %22select * from token%22;%0A            PreparedStatement pstmt = conn.prepareStatement(sql);%0A            ResultSet rs = pstmt.executeQuery();%0A            while (rs.next()) %7B%0A                Token bean = new Token();%0A                bean.setTokenId(rs.getInt(%22id%22));%0A                bean.setPassword(rs.getString(%22password%22));%0A                bean.setAmount(rs.getDouble(%22amount%22));%0A%0A                al.add(bean);%0A            %7D%0A            c.putConnection(conn);%0A%0A        %7D catch (Exception e) %7B%0A            System.out.println(%22Exception %22 + e);%0A        %7D%0A        return al;%0A    %7D%0A public void update(Token a) %7B%0A        ArrayList%3CToken%3E al = new ArrayList%3CToken%3E();%0A        try %7B%0A            if (c == null) %7B%0A                c = ConnectionPool.getInstance();%0A                c.initialize();%0A            %7D%0A            conn = c.getConnection();%0A             String sql = %22Update token set amount=? where id = ?%22;%0A            PreparedStatement pstmt = conn.prepareStatement(sql);%0A            ResultSet rs = pstmt.executeQuery();%0A            pstmt.setDouble(1, a.getAmount());%0A            pstmt.setInt(2, a.getTokenId());%0A            pstmt.executeUpdate();%0A            c.putConnection(conn);%0A%0A        %7D catch (Exception e) %7B%0A            System.out.println(%22Exception %22 + e);%0A        %7D%0A%0A    %7D%0A%7D%0A

Create TokenDAO.java