How to use org.neo4j.driver.Session properly for subsequent queries?

For the no entry found:
You are putting the parameter into single quotes '$name'. This will not work because it will get treated as a string literal. Remove the quotes and the parameter replacement should work.