-
Dec 6th, 2012, 02:00 PM
#1
Can we use generic type in model?
calss GeneralModal<T extends BaseEntity>
{
private T entity
public void setEntity(T entity)
{
this.entity=entity;
}
public T getEntity()
{
return entity;
}
}
Now I have in my controller
@Override
@RequestMapping(value="", method=RequestMethod.POST)
@ResponseBody
public ModelAndView Filter(@ModelAttribute("entity") GeneralModal<RoleEntity> entity, BindingResult result, SessionStatus status) throws InstantiationException, IllegalAccessException
{
return super.Filter(entity, result, status);
}
Now before this method getting called it tries to fill
@ModelAttribute("entity") GeneralModal<RoleEntity> entity
where it gives error saying that
Can't instantiate
T entity
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules