Code example for SQLException

Methods: toString

0
            String sql = getQueryExpression(tableName, primKeyName);
            stmt = conn.prepareStatement(sql);
            ResultSet rs = stmt.executeQuery();
            return _typeHandler.getNextValue(rs);
        } catch (SQLException ex) {
            throw new PersistenceException(Messages.format( 
                    "persist.keyGenSQL", getClass().getName(), ex.toString()), ex);
        } finally { 
            if (stmt != null) {
                try { 
                    stmt.close();
                } catch (SQLException ex) {
                    LOG.warn (Messages.message ("persist.stClosingFailed"), ex);
                } 
            } 
        } 
    } 
 
    /** 
     * Get query string to retrive next primary key value.