@Override
    public long deleteSingleTicket(final Ticket ticketToDelete) {
        val result = transactionTemplate.execute(transactionStatus -> {
            val factory = getJpaTicketEntityFactory();
            val encTicketId = digestIdentifier(ticketToDelete.getId());
            var totalCount = 0;
            val md = ticketCatalog.find(ticketToDelete);

            if (md.getProperties().isCascadeRemovals()) {
                totalCount = deleteTicketGrantingTickets(encTicketId);
            } else {
                val sql = String.format("DELETE FROM %s o WHERE o.id = :id", factory.getEntityName());
                val query = entityManager.createQuery(sql);
                query.setParameter("id", encTicketId);
                totalCount = query.executeUpdate();
            }
            return totalCount;
        });
        return Objects.requireNonNull(result);
    }
This method purposefully doesn't lock any rows, because the stream traversing can take an indeterminate
amount of time, and logging in to an application with an existing TGT will update the TGT row in the database.

@return streamable results
support/cas-server-support-jpa-ticket-registry/src/main/java/org/apereo/cas/ticket/registry/JpaTicketRegistry.java