code: public Token findTokenByUid(String uid) {
          EntityManager entityManager = getEntityManager();
          try {
  			return entityManager.createQuery("SELECT token FROM Token AS token WHERE uid = :uid", Token.class)
  					.setParameter("uid", uid).setMaxResults(1).getSingleResult();
  		} catch (NoResultException e) {
  			return null;
  		} finally {
  			entityManager.close();
  		}
  	}
docs: findTokenByUid
  
  @param uid
  @return