Re: Test
От: anterior_ Россия  
Дата: 19.10.05 10:46
Оценка:
Здравствуйте, anterior_, Вы писали:

_>
_>    public Collection selectMessagesByChannel(long channelId) {
_>        Collection messages = new ArrayList();
_>        try {
_>            Connection conn = DAOFactory.getConnection();
_>            try {
_>                PreparedStatement query = conn.prepareStatement(
_>                        "select ID from jsub_Messages where ChannelID=?");
_>                query.setLong(1, channelId);
_>                ResultSet rs = query.executeQuery();
_>                while(rs.next()) {
_>                    Message message = findByPrimaryKey(rs.getLong("ID"));
_>                    messages.add(message);
_>                }
_>                rs.close();
_>                query.close();
_>            } finally {
_>                conn.close();
_>            }
_>        } catch(Exception e) {
_>            Log.error("Couldn't select messages by channel \"" + channelId + "\"", e);
_>        }        
_>        return messages;
_>    }
_>

OK
Giving up smoking is the easiest thing in the world. I know because I've done it thousands of times. (c) Mark Twain
 
Подождите ...
Wait...
Пока на собственное сообщение не было ответов, его можно удалить.