public static ConversationOrder getActiveOrder(Conversation conversation) {
    Query q =
        JPA.em()
            .createQuery(
                "SELECT o from ConversationOrder o where conversation = ?1 and active = ?2 and deleted = false");
    q.setParameter(1, conversation);
    q.setParameter(2, true);
    q.setMaxResults(1);

    if (q.getMaxResults() > 1) {
      logger
          .underlyingLogger()
          .error("[conv=" + conversation.id + "] has " + q.getMaxResults() + " active orders!!");
    }

    try {
      return (ConversationOrder) q.getSingleResult();
    } catch (NoResultException e) {
      return null;
    }
  }
  public UsuarioEntity login(UsuarioEntity entity) {
    Query q =
        em.createQuery(
            "select u from UsuarioEntity u where u.correo = '" + entity.getCorreo() + "'");

    if (q.getMaxResults() != 0) {
      UsuarioEntity usr = (UsuarioEntity) q.getSingleResult();

      if (usr.getPassword().equals(entity.getPassword())) {
        return usr;
      }
    }
    return null;
  }