on the other hand even creating connection in the method (and closing it when the method ends ), should also be no problem because the connections are obtained and released from/to the pool.
If you see an error/warning when you are using the recommended method from the tutorial , please file an issue in glassfish
[Message sent by forum member 'rampsarathy' (rampsarathy)]
http://forums.java.net/jive/thread.jspa?messageID=275898