// Declaring fetch type for one to many association in your POJO
@OneToMany(mappedBy = "user", fetch = FetchType.LAZY)
private Set documents = new HashSet();
// To fetch user with document use initialize() method as follows
User user = (User)session.get(User.class, new Integer(100));
//This code will fetch all products for user 100 from database 'NOW'
documents = user.getDocuments();

Site Footer

Sliding Sidebar

About Me

About Me

Hello, my name is Dũng (Johnny). Welcome to my blog.

As I’m a developer, I write about topics related to the field of programming, mainly from a technical point of view. On this blog you’ll find posts which encourage discussion, information about development trends, case studies, reviews, tutorials, tips on how to improve your effectiveness, and anything else that might be fascinating to people from the IT industry.

  • http://lcdung.top/about/
  • Mail: ledung@8bitbase.com

Time line