ps = null;  ps = conn.prepareStatement(selectId);  rs = ps.executeQuery();  rs.next();  long id = rs.getLong(1);  failed = false;  return id;
ps = null;
   protected long insertMappingRow(char type, String jmsDestName, String jmsSubName, String clientID,                                   String selector, Boolean noLocal) throws Exception   {      Connection conn = null;      PreparedStatement ps  = null;      ResultSet rs = null;      TransactionWrapper wrap = new TransactionWrapper();            boolean failed = true;            try      {         conn = ds.getConnection();                  ps = conn.prepareStatement(insertMapping);                  ps.setNull(1, Types.BIGINT);                  ps.setString(2, String.valueOf(type));                   ps.setString(3, jmsDestName);                  ps.setString(4, jmsSubName);                  ps.setString(5, clientID);                  ps.setString(6, selector);                  if (noLocal == null)         {            ps.setNull(7, Types.VARCHAR);         }         else         {            ps.setString(7, noLocal.booleanValue() ? "Y" : "N");         }                           int rows = ps.executeUpdate();                  failed = rows != 1;                   ps.close();                  ps = null;                  ps = conn.prepareStatement(selectId);                  rs = ps.executeQuery();                  rs.next();                  long id = rs.getLong(1);                     failed = false;                  return id;      }      finally      {         if (log.isTraceEnabled())         {            String s = JDBCUtil.            statementToString(insertMapping, null, String.valueOf(type), jmsDestName, jmsSubName,                  clientID, selector, noLocal);            log.trace(s + (failed ? " failed!" : " executed successfully"));         }                  if (rs != null)         {            try            {               rs.close();            }            catch (Throwable t)            {}         }         if (ps != null)         {            try            {               ps.close();            }            catch (Throwable t)            {}         }         if (conn != null)         {            try            {               conn.close();            }            catch (Throwable t)            {}         }         wrap.end();      }   }