@SuppressWarnings({"cast","unchecked"}) public List<Note> listNote(User user) throws UnauthorizedException {
  if (user == null) {
    throw new UnauthorizedException("missing user");
  }
  EntityManager mgr=getEntityManager();
  List<Note> result=new ArrayList<Note>();
  try {
    Query query=mgr.createQuery("select n from Note n where n.emailAddress = :emailAddress");
    query.setParameter("emailAddress",user.getEmail());
    for (    Object obj : (List<Object>)query.getResultList()) {
      result.add(((Note)obj));
    }
  }
  finally {
    mgr.close();
  }
  return result;
}

@ SuppressWarnings ( { "cast" , "unchecked" } ) public List < Note > listNote ( User user ) throws UnauthorizedException { if ( user == null ) { throw new UnauthorizedException ( "missing user" ) ; } EntityManager mgr = getEntityManager ( ) ; List < Note > result = new ArrayList < Note > ( ) ; try { Query query = mgr . createQuery ( "select n from Note n where n.emailAddress = :emailAddress" ) ; query . setParameter ( "emailAddress" , user . getEmail ( ) ) ; for ( Object obj : ( List < Object > ) query . getResultList ( ) ) { result . add ( ( ( Note ) obj ) ) ; } } finally { mgr . close ( ) ; } return result ; }
this method lists all the entities inserted in datastore . it uses http get method .
