• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Liutauras Vilda
  • Paul Clapham
Sheriffs:
  • paul wheaton
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Piet Souris
Bartenders:
  • Mike London

Spring 3.0 and Hibernate newbie question

 
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I need to select data from 2 tables using hibernate and display it on a JSP. He is my question. The 2 tables have a common key. how is the best way to join them and Also it is a one to many. so I need to display some of table 1 data on the JSP and I may have one more more rows return from the secound table. I get Confused when I think about returning the model and View and I need to return to one object for the top of the jsp and a List of objects for the bottom of the JSP. Can any one please give me some type of direct on my issue. I don't really understand how to return 2 diffrent object in the modelandview to the JSP.

Thanks
 
ranger
Posts: 17347
11
Mac IntelliJ IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Todd Smith wrote:I need to select data from 2 tables using hibernate and display it on a JSP. He is my question. The 2 tables have a common key. how is the best way to join them and Also it is a one to many. so I need to display some of table 1 data on the JSP and I may have one more more rows return from the secound table. I get Confused when I think about returning the model and View and I need to return to one object for the top of the jsp and a List of objects for the bottom of the JSP. Can any one please give me some type of direct on my issue. I don't really understand how to return 2 diffrent object in the modelandview to the JSP.

Thanks



For your Hibernate query, you will need to post that into our ORM forum.

For ModelAndView object, the Model portion is just a map, so you add() to the ModelAndView and give each a name

modelAndView.add("firstTable", firstTableData);
modelAndView.add("secondTable", secondTableData);

return modelAndView;

Mark
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic