Explain the difference between JPA/Hibernate one-to-many and many-to-many mappings, and how you would prevent the N+1 query problem.