Package org.apache.geronimo.timer

Examples of org.apache.geronimo.timer.PersistenceException


                        insertStatement.setLong(7, workInfo.getPeriod().longValue());
                    }
                    insertStatement.setBoolean(8, workInfo.getAtFixedRate());
                    int result = insertStatement.executeUpdate();
                    if (result != 1) {
                        throw new PersistenceException("Could not insert!");
                    }
                } finally {
                    insertStatement.close();
                }
            } else {
                PreparedStatement insertStatement = c.prepareStatement(insertSQLWithIdentity);
                try {
                    String serializedUserId = serialize(workInfo.getUserId());
                    String serializedUserKey = serialize(workInfo.getUserInfo());
                    insertStatement.setString(1, serverUniqueId);
                    insertStatement.setString(2, workInfo.getKey());
                    insertStatement.setString(3, serializedUserId);
                    insertStatement.setString(4, serializedUserKey);
                    insertStatement.setLong(5, workInfo.getTime().getTime());
                    if (workInfo.getPeriod() == null) {
                        insertStatement.setNull(6, Types.NUMERIC);
                    } else {
                        insertStatement.setLong(6, workInfo.getPeriod().longValue());
                    }
                    insertStatement.setBoolean(7, workInfo.getAtFixedRate());
                    int result = insertStatement.executeUpdate();
                    if (result != 1) {
                        throw new PersistenceException("Could not insert!");
                    }
                } finally {
                    insertStatement.close();
                }
                long id;
                PreparedStatement identityStatement = c.prepareStatement(identitySQL);
                try {
                    ResultSet seqRS = identityStatement.executeQuery();
                    try {
                        seqRS.next();
                        id = seqRS.getLong(1);
                    } finally {
                        seqRS.close();
                    }
                } finally {
                    identityStatement.close();
                }
                workInfo.setId(id);
            }
        } catch (SQLException e) {
            threwException = true;
            throw new PersistenceException(e);
        } finally {
            close(c, !threwException);
        }
    }
View Full Code Here


            } finally {
                deleteStatement.close();
            }
        } catch (SQLException e) {
            threwException = true;
            throw new PersistenceException(e);
        } finally {
            close(c, !threwException);
        }
    }
View Full Code Here

            } finally {
                selectStatement.close();
            }
        } catch (SQLException e) {
            threwException = true;
            throw new PersistenceException(e);
        } finally {
            close(c, !threwException);
        }
    }
View Full Code Here

            } finally {
                updateStatement.close();
            }
        } catch (SQLException e) {
            threwException = true;
            throw new PersistenceException(e);
        } finally {
            close(c, !threwException);
        }
    }
View Full Code Here

            } finally {
                updateStatement.close();
            }
        } catch (SQLException e) {
            threwException = true;
            throw new PersistenceException(e);
        } finally {
            close(c, !threwException);
        }
    }
View Full Code Here

            } finally {
                selectStatement.close();
            }
        } catch (SQLException e) {
            threwException = true;
            throw new PersistenceException(e);
        } finally {
            close(c, !threwException);
        }

        return ids;
View Full Code Here

    private Connection getConnection() throws PersistenceException {
        try {
            return dataSource.getConnection();
        } catch (Exception e) {
            throw new PersistenceException(e);
        }
    }
View Full Code Here

    private void close(Connection c, boolean reportSqlException) throws PersistenceException {
        try {
            c.close();
        } catch (Exception e) {
            if (!reportSqlException) {
                throw new PersistenceException(e);
            }
        }
    }
View Full Code Here

                            insertStatement.setLong(7, workInfo.getPeriod().longValue());
                        }
                        insertStatement.setBoolean(8, workInfo.getAtFixedRate());
                        int result = insertStatement.executeUpdate();
                        if (result != 1) {
                            throw new PersistenceException("Could not insert!");
                        }
                    } finally {
                        insertStatement.close();
                    }
                } else {
                    PreparedStatement insertStatement = c.prepareStatement(insertSQLWithIdentity);
                    try {
                        String serializedUserId = serialize(workInfo.getUserId());
                        String serializedUserKey = serialize(workInfo.getUserInfo());
                        insertStatement.setString(1, serverUniqueId);
                        insertStatement.setString(2, workInfo.getKey());
                        insertStatement.setString(3, serializedUserId);
                        insertStatement.setString(4, serializedUserKey);
                        insertStatement.setLong(5, workInfo.getTime().getTime());
                        if (workInfo.getPeriod() == null) {
                            insertStatement.setNull(6, Types.NUMERIC);
                        } else {
                            insertStatement.setLong(6, workInfo.getPeriod().longValue());
                        }
                        insertStatement.setBoolean(7, workInfo.getAtFixedRate());
                        int result = insertStatement.executeUpdate();
                        if (result != 1) {
                            throw new PersistenceException("Could not insert!");
                        }
                    } finally {
                        insertStatement.close();
                    }
                    long id;
                    PreparedStatement identityStatement = c.prepareStatement(identitySQL);
                    try {
                        ResultSet seqRS = identityStatement.executeQuery();
                        try {
                            seqRS.next();
                            id = seqRS.getLong(1);
                        } finally {
                            seqRS.close();
                        }
                    } finally {
                        identityStatement.close();
                    }
                    workInfo.setId(id);
                }
            } finally {
                c.close();
            }
        } catch (SQLException e) {
            throw new PersistenceException(e);
        }
    }
View Full Code Here

                }
            } finally {
                c.close();
            }
        } catch (SQLException e) {
            throw new PersistenceException(e);
        }

    }
View Full Code Here

TOP

Related Classes of org.apache.geronimo.timer.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.