Hey buddy,
No it's not a good solution, try a book related to JPA, to find better solution for relations and cascades. I couldn't find out the exact relationship between document and template but I feel there is something wrong in your design, that's why you retrieve null.
You can try Apress Pro EJB 3 Java Persistence API book. I've found it so great.
Regards,
James
[Message sent by forum member 'nasim_kabi' (nasim_kabi)]
http://forums.java.net/jive/thread.jspa?messageID=251299