}
protected static Integer getSequenceNextVal(String sequenceName) throws DAOException {
if (sequenceName == null) {
throw new DAOException("sequenceName cannot be null");
}
Integer nextval=null;
PreparedStatement statement = null;
ResultSet result;
Connection connection = DAOHelper.getDBConnection();
try {
try
{
statement = connection.prepareStatement(NEXTVAL_QRY);
statement.setString(1, sequenceName);
result = statement.executeQuery();
if(result.next())
{
nextval = new Integer(result.getInt("nextval"));
if(result.next())
{
throw new DAOException("Multiple rows returned for nextval sequence '"+sequenceName+"'");
}
}
else {
throw new DAOException("Selection of nextval for sequence '" + sequenceName + "' returned no row");
}
}
catch(SQLException exc)
{
throw new DAOException(exc.getMessage());
}//End catch IOException
}
// This code is to be executed each time in order to release DB Connections
finally
{