hibernate的官方文档里有个例子:
Cat cat = session1.get(Cat.class, catId);
Cat cat = (Cat) firstSession.load(Cat.class, catID);
catID指对象标识符。二个catID意思是一样的.
catID 不能是long,int 型的,必须是 Long, Integer型的。
By the way, catID can not be long, int, it must be Long, Integer, which implements serializable interface. So if your class id is long or int, you have to use Cat cat = (Cat) firstSession.load(Cat.class, new Integer(myCatID); here myCatID is int type.