-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: very urgent, plz..how use joins on below code
PostPosted: Sat Mar 05, 2011 3:48 am 
Newbie

Joined: Thu Feb 17, 2011 2:30 am
Posts: 3
i want to apply joins ,on this code,


public List<SnStudentAssessment> getClassAssessment(
AssessmentCommand assessmentCommand, String username,
SnSchool snSchool) throws DataAccessException,
java.sql.SQLException, ParseException {

List<SnStudentAssessment> marksList = null;

Session session = this.getSession();
Transaction transaction = session.beginTransaction();
Query query = null;
StringBuffer queryBuffer = new StringBuffer(
"from com.tsb.nirvahak.student.hibernate.SnStudentAssessment");
if (assessmentCommand.getAssessmentType().equals("I")) {
HashMap searchFilters = new HashMap();
searchFilters.put("month", new SearchFilterData("month",
assessmentCommand.getMonth(),
SearchFilterData.TYPE_STRING_STR));
searchFilters.put("year", new SearchFilterData("year",
assessmentCommand.getYear(),
SearchFilterData.TYPE_NUMERIC_STR));
searchFilters.put("class_id", new SearchFilterData("class_id",
assessmentCommand.getKlassId(),
SearchFilterData.TYPE_NUMERIC_STR));
Iterator iterator = searchFilters.keySet().iterator();
boolean hasNext = iterator.hasNext();
if (hasNext) {
queryBuffer.append(" where ");
}
HibernateDaoUtil.appendGridFilter(queryBuffer, searchFilters);


query = session.createQuery(queryBuffer.toString());

} else if (assessmentCommand.getAssessmentType().equals("T")) {
queryBuffer.append("a.classId =:classId and a.term =:term");
query = session.createQuery(queryBuffer.toString());
query.setLong("classId", assessmentCommand.getKlassId());
query.setString("term", assessmentCommand.getTerm());
} else {
return new ArrayList<SnStudentAssessment>();
}

marksList = query.list();
Iterator<SnStudentAssessment> iter = query.iterate();

Iterator iterator = marksList.iterator();

while (iter.hasNext()) {
SnStudentAssessment assessment = (SnStudentAssessment) iter.next();
assessment.getGrade();
assessment.getMaths();
assessment.getSnStudent().getId();
assessment.getSnStudent().getFirstName();
assessment.getSnStudent().getLastName();

}

transaction.commit();
session.close();

return marksList;
}





please help me


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.