code: private int deleteTicketGrantingTickets(final String ticketId) {
          var totalCount = 0;
  
          val st = this.ticketCatalog.find(ServiceTicket.PREFIX);
  
          val sql1 = String.format("delete from %s s where s.ticketGrantingTicket.id = :id", getTicketEntityName(st));
          var query = entityManager.createQuery(sql1);
          query.setParameter("id", ticketId);
          totalCount += query.executeUpdate();
  
          val tgt = this.ticketCatalog.find(TicketGrantingTicket.PREFIX);
          val sql2 = String.format("delete from %s s where s.ticketGrantingTicket.id = :id", getTicketEntityName(tgt));
          query = entityManager.createQuery(sql2);
          query.setParameter("id", ticketId);
          totalCount += query.executeUpdate();
  
          val sql3 = String.format("delete from %s t where t.id = :id", getTicketEntityName(tgt));
          query = entityManager.createQuery(sql3);
          query.setParameter("id", ticketId);
          totalCount += query.executeUpdate();
  
          return totalCount;
      }
docs: Delete ticket granting tickets int.
  
  @param ticketId the ticket id
  @return the int