Created
June 2, 2014 17:48
-
-
Save BalajiIyengar/2e8ec5cad5159dbb5ab1 to your computer and use it in GitHub Desktop.
java templates for eclipse
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
For Iteration(Fastest) | |
for (int i = Object.size(); i > 0; i--) { | |
Object.get(i); | |
} | |
spring jdbc mapper | |
/** | |
* | |
* This class is used to Map the ResultSet values to Domain/Value Objects | |
* | |
*/ | |
private static class ObjectMapper | |
implements | |
ParameterizedRowMapper<Object> { | |
public Object mapRow(ResultSet rs, int rowNum) throws SQLException { | |
User user = new User(); | |
//user.setValues(); | |
// .... | |
return user; | |
} | |
} | |
Count Query JDBC | |
String profileAlreadyExistsQuery="select count(1) from student_profile where emailid=? "; | |
int profileCount=getJdbcTemplate().queryForInt(profileAlreadyExistsQuery,student.getEmailID()); | |
Update Query Spring JDBC | |
getJdbcTemplate().update("insert into student_details (email_id,primary_skills,secondary_skills)" | |
+ "values (?,?,?)", | |
new Object[]{ | |
student.getEmailID(), | |
primarySkillList, | |
secondarySkillsList}, | |
new int[]{ | |
Types.VARCHAR, | |
Types.ARRAY, | |
Types.ARRAY}); | |
Ajax Request Mapping | |
@RequestMapping(method = RequestMethod.GET, value = "someUrl") | |
@ResponseBody | |
public Object someMethodName(@RequestParam("emailID") String emailID, HttpServletResponse httpServletResponse) | |
{ | |
} | |
Request Mapping | |
@RequestMapping(value=CaerusAnnotationURLConstants.CANDIDATE_ADVANCED_SEARCH_CONTROLLER,method=RequestMethod.POST) | |
protected ModelAndView onSubmit(HttpServletRequest request , @ModelAttribute("searchJobs") SearchJobs searchJobs , BindingResult bindingResult) throws Exception | |
{ | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment