我在上一个项目中这样写没问题:
public Object findByID(int id) {
// TODO Auto-generated method stub
try {
return this.getHibernateTemplate().get(ColumnContent.class, id); } catch (Exception e) {
// TODO: handle exception
e.printStackTrace();
return null;
}
}
现在我新起了一个项目,再这样写就报错了.提示说需要把id的类型改为Serializable的.不知道为什么会这样?
如果是Serializable的ID,传值是传int型的么?
public Object findByID(int id) {
// TODO Auto-generated method stub
try {
return this.getHibernateTemplate().get(ColumnContent.class, id); } catch (Exception e) {
// TODO: handle exception
e.printStackTrace();
return null;
}
}
现在我新起了一个项目,再这样写就报错了.提示说需要把id的类型改为Serializable的.不知道为什么会这样?
如果是Serializable的ID,传值是传int型的么?
// TODO Auto-generated method stub
try {
return this.getHibernateTemplate().get(ColumnContent.class, id); } catch (Exception e) {
// TODO: handle exception
e.printStackTrace();
return null;
}
}
而且能用.奇怪........怎么传一个序列化的ID给这个方法?调用这个方法的类实现序列化的接口?