code: @SuppressWarnings("unchecked")
  	private void queryForCoursesWithTeachersWithFirstAndLastName() {
  		System.out.println(">> Query for courses whose teacher have a frist and last name:");
  		//using Java method in query
  		Query q = pm.newQuery(Course.class, "teacher.name.indexOf(' ') >= 1");
  		Collection<Course> courses = (Collection<Course>)q.execute(); 
  		for (Course c : courses) {
  			System.out.println(">> - " + c.getName() + 
  					" has teacher: " + c.getTeacher().getName());
  		}
  	}
docs: This example combines a path query with a Java method call on the String class.