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

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


            }
            // TODO(ob): update the user statistics if no tiger?
            conn.commit();
        } catch (Exception e) {
            Database.rollback(conn);
            throw new PersistenceException("Failed to update submission.", e);
        } finally {
            Database.dispose(conn);
        }
    }
View Full Code Here


                ps = conn.prepareStatement(SubmissionPersistenceImpl.INACTIVE_SUBMISSION);
                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 submission");
                }
            } finally {
                Database.dispose(ps);
            }
        } catch (Exception e) {
            throw new PersistenceException("Failed to delete submission.", e);
        } finally {
            Database.dispose(conn);
        }
    }
View Full Code Here

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

            try {
                ps = conn.prepareStatement("SELECT content FROM submission WHERE submission_id=?");
                ps.setLong(1, id);
                ResultSet rs = ps.executeQuery();
                if (!rs.next()) {
                    throw new PersistenceException("Submission id " + id + " not found");
                }
                String content = rs.getString("content");
                if (content == null) {
                    return "";
                } else {
                    return content;
                }
            } finally {
                Database.dispose(ps);
            }
        } catch (SQLException e) {
            throw new PersistenceException("Failed to get the submission with id " + id, e);
        } finally {
            Database.dispose(conn);
        }
    }
View Full Code Here

                return submissions;
            } finally {
                Database.dispose(ps);
            }
        } catch (SQLException e) {
            throw new PersistenceException("Failed to get the submissions", e);
        } finally {
            Database.dispose(conn);
        }

    }
View Full Code Here

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

            }
            List<RankListEntry> entryList = new ArrayList<RankListEntry>(entries.values());
            Collections.sort(entryList);
            return entryList;
        } catch (SQLException e) {
            throw new PersistenceException("Failed to get the rank list", e);
        } finally {
            Database.dispose(conn);
        }
    }
View Full Code Here

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

            r.setUsers(users.toArray(new UserProfile[0]));
            r.setSolved(solvedArray);
            r.setTotal(totalArray);
            return r;
        } catch (SQLException e) {
            throw new PersistenceException("Failed to get the rank list", e);
        } finally {
            Database.dispose(conn);
        }
    }
View Full Code Here

                return statistics;
            } finally {
                Database.dispose(ps);
            }
        } catch (SQLException e) {
            throw new PersistenceException("Failed to get the user statistics", 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.