Java Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsProgramming LanguagesJava Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old January 11th, 2013, 05:46 PM
loulou loulou is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2005
Posts: 385 loulou User rank is Corporal (100 - 500 Reputation Level)loulou User rank is Corporal (100 - 500 Reputation Level)loulou User rank is Corporal (100 - 500 Reputation Level)loulou User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 4 Days 20 h 7 m 56 sec
Reputation Power: 9
Hibernate/spring mvc database results not returning correctly

Hi,

I am a little rusty haven't done this in almost a year. But, I am just returning a list of objects from a database result, the number of results are returning correct, however, it's just giving me a repeat of the first result when I display my jsp.

Can you please check my work below and help me spot where the problem is?

Thanks so much


Here is my database query:

Code:
public List<Checklist[]> getChecklist(String employid) throws PortletException {
		List<Checklist[]> result = null;
		if(employid == null){
			throw new PortletException("Programming error: getChecklist called with null parameter");
		}
		try{
			result = getHibernateTemplate().find("from Checklist where employid = '" + employid + "' order by requirement"); 	
		        //size here is outputting correctly
			System.out.println("Size:" + result.size());
		}catch (HibernateException ex) {
			throw convertHibernateAccessException(ex);
		}
		return result;
	}


Here is the relevant part of the Controller:
Code:
...
         @SuppressWarnings("unchecked")
	@RequestMapping("VIEW")
	public String mainView(Model model, RenderRequest request) 
		throws PortletException {
		List<Checklist[]> checklists;
                //calls function from above
		checklists = checklistStore.getChecklist(userid);
		model.addAttribute("checklists",checklists);		
		return "view";
	}


Here is my view.jsp:

Code:
<c:forEach items="${checklists}" var="item" varStatus="status">
	${item.requirement}
</c:forEach>



Here is my object:

Code:
public class Checklist implements Serializable{
	
	private static final long serialVersionUID = 1L;
	
	private String employid;
	private String lastname;
	private String firstname;
	private String requirement;
	private String status;
	private String office;
	
	public String getEmployid(){
		return employid;
	}
	
	public void setEmployid(String employid){
		this.employid = employid;
	}
	
	public String getLastname(){
		return lastname;
	}

	public void setLastname(String lastname){
		this.lastname = lastname;
	}
	
	public String getFirstname(){
		return firstname;
	}
	
	public void setFirstname(String firstname){
		this.firstname = firstname;
	}
	
	public String getRequirement(){
		return requirement;
	}
	
	public void setRequirement(String requirement){
		this.requirement = requirement;
	}
	
	public String getStatus(){
		return status;
	}
	
	public void setStatus(String status){
		this.status = status;
	}
	
	public String getOffice(){
		return office;
	}
	
	public void setOffice(String office){
		this.office = office;
	}
}

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesJava Help > Hibernate/spring mvc database results not returning correctly

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap