code: static List<User> onQueryByEmail(final EntityManager em, final User user) 
      {
  		// Query by parameter (fetch user by email id)
  		String query = "Select u from User u where u.emailId =?1";
  
  		logger.info("");
  		logger.info("");
  		logger.info(query);
  		System.out.println("#######################Querying##########################################");
  
  		// find by named parameter(e.g. email)
  		List<User> fetchedUsers = findByEmail(em, query, user.getEmailId());
  		return fetchedUsers;
  	}
docs: on query with user email id
  
  @param em         entity manager instance.
  @param user       user entity instance.
  @return           collection of user instance.