public static boolean addEntity(EntityBean entity) {
      boolean good = true;

      try {
         ResultSet rset = null;
         PreparedStatement stmt = null;

         // first: add the entity in the entity table
         {
            String statementName = "addEntity";
            SQLConnManager connMgr = new SQLConnManager(statementName, new ErrorBean());

            try {
               // Get database connection
               if ((connMgr.getConn()) == null) {
                  good = false;
               }
               else {
                  // Load up the correct SQL statement
                  stmt = connMgr.loadPreparedStatement(statementName);
                  stmt.setInt(1, entity.getParentId());
                  stmt.setString(2, entity.getName());
                  stmt.setInt(3,(entity.isActive() ? 1 : 0));
                  stmt.setString(4, entity.getNote());
                  stmt.setString(5, entity.getAudioName());
                  stmt.executeUpdate();
               }
            }
            catch (Exception e) {
               good = false;
               UtilBundle.log.logMessage(e, statementName, LogUtil.SEVERE);
            }
            // Free resources allocated.
            connMgr.shutDown(true);
         }
         // second: get the entity
         {
            String statementName = "lookupLastEntityId";
            SQLConnManager connMgr = new SQLConnManager(statementName, new ErrorBean());

            try {
               // Get database connection
               if ((connMgr.getConn()) == null) {
                  good = false;
               }
               else {
                  stmt = connMgr.loadPreparedStatement(statementName);
                  rset = stmt.executeQuery();
                  if(rset.next()) {
                     entity.setEntityId(rset.getInt(1));
                     System.out.println("new entity: " + entity.getName() + " has id: " + entity.getEntityId());
                  } else {
                     System.out.println("something is wrong..did not get new id");
                  }
               }
            }
            catch (Exception e) {
               good = false;
               UtilBundle.log.logMessage(e, statementName, LogUtil.SEVERE);
            }
            // Free resources allocated.
            connMgr.shutDown(true);
         }
         // third: add the phoneNumber in the phonenumber table
         if(addPhoneNumber(entity)) {
            System.out.println("added phone number");
         } else {
            System.out.println("did not add phone number");
         }
      }
      catch (Exception e) {
         good=false;
         e.printStackTrace(System.err);
      }
      return good;
   }