Package cn.edu.zju.acm.onlinejudge.persistence

Examples of cn.edu.zju.acm.onlinejudge.persistence.PersistenceException


                forum.setId(rs.getLong(1));
            } finally {
                Database.dispose(ps);
            }
        } catch (SQLException e) {
            throw new PersistenceException("Failed to create forum.", e);
        } finally {
            Database.dispose(conn);
        }

    }
View Full Code Here


                ps.setString(2, forum.getDescription());
                ps.setLong(3, user);
                ps.setTimestamp(4, new Timestamp(new Date().getTime()));
                ps.setLong(5, forum.getId());
                if (ps.executeUpdate() == 0) {
                    throw new PersistenceException("no such forum");
                }
            } finally {
                Database.dispose(ps);
            }
        } catch (PersistenceException e) {
            throw e;
        } catch (Exception e) {
            throw new PersistenceException("Failed to update forum.", e);
        } finally {
            Database.dispose(conn);
        }
    }
View Full Code Here

                ps = conn.prepareStatement(ForumPersistenceImpl.DELETE_FORUM);
                ps.setLong(1, user);
                ps.setTimestamp(2, new Timestamp(new Date().getTime()));
                ps.setLong(3, id);
                if (ps.executeUpdate() == 0) {
                    throw new PersistenceException("no such forum");
                }
            } finally {
                Database.dispose(ps);
            }
        } catch (PersistenceException e) {
            throw e;
        } catch (SQLException e) {
            // TODO(xuchuan): check all SQLException
            throw new PersistenceException("Failed to delete forum.", e);
        } finally {
            Database.dispose(conn);
        }
    }
View Full Code Here

                }
            } finally {
                Database.dispose(ps);
            }
        } catch (SQLException e) {
            throw new PersistenceException("Failed to get the forum with id " + id, e);
        } finally {
            Database.dispose(conn);
        }
    }
View Full Code Here

                return forums;
            } finally {
                Database.dispose(ps);
            }
        } catch (SQLException e) {
            throw new PersistenceException("Failed to get all forums", e);
        } finally {
            Database.dispose(conn);
        }
    }
View Full Code Here

                thread.setId(rs.getLong(1));
            } finally {
                Database.dispose(ps);
            }
        } catch (SQLException e) {
            throw new PersistenceException("Failed to create thread.", e);
        } finally {
            Database.dispose(conn);
        }
    }
View Full Code Here

                ps.setString(3, thread.getTitle());
                ps.setLong(4, user);
                ps.setTimestamp(5, new Timestamp(new Date().getTime()));
                ps.setLong(6, thread.getId());
                if (ps.executeUpdate() == 0) {
                    throw new PersistenceException("no such thread");
                }
            } finally {
                Database.dispose(ps);
            }
        } catch (PersistenceException pe) {
            throw pe;
        } catch (SQLException e) {
            throw new PersistenceException("Failed to update thread.", e);
        } finally {
            Database.dispose(conn);
        }
    }
View Full Code Here

                ps = conn.prepareStatement(ForumPersistenceImpl.DELETE_THREAD);
                ps.setLong(1, user);
                ps.setTimestamp(2, new Timestamp(new Date().getTime()));
                ps.setLong(3, id);
                if (ps.executeUpdate() == 0) {
                    throw new PersistenceException("no such thread");
                }
            } finally {
                Database.dispose(ps);
            }
        } catch (PersistenceException pe) {
            throw pe;
        } catch (SQLException e) {
            throw new PersistenceException("Failed to delete thread.", e);
        } finally {
            Database.dispose(conn);
        }
    }
View Full Code Here

                }
            } finally {
                Database.dispose(ps);
            }
        } catch (SQLException e) {
            throw new PersistenceException("Failed to get the thread with id " + id, e);
        } finally {
            Database.dispose(conn);
        }
    }
View Full Code Here

                post.setId(rs.getLong(1));
            } finally {
                Database.dispose(ps);
            }
        } catch (SQLException e) {
            throw new PersistenceException("Failed to create post.", e);
        } finally {
            Database.dispose(conn);
        }
    }
View Full Code Here

TOP

Related Classes of cn.edu.zju.acm.onlinejudge.persistence.PersistenceException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.