session.get()/load()的参数使用问题!
2013-01-12 21:51
323 查看
在做课设keshe的时候:由于定义主键id是int类型的,所以在用session.load/get()方法是就会出错。用session.createCriteria().add(Restriction.eq("",id))
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.
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.
相关文章推荐
- ireport $P{SUBREPORT_DIR}参数的使用 解决:Could not load object from location 不能加载子报表问题
- SpringMVC中使用Ajax POST请求以json格式传递参数服务端通过request.getParameter("name")无法获取参数值问题分析
- 在linux下使用curl访问 多参数url GET参数问题
- android客户端通过Get方式提交参数给服务器,使用URL和HttpURLConnection实现,以及乱码问题解决
- android客户端通过Get方式提交参数给服务器,使用URL和HttpURLConnection实现,以及乱码问题解决
- 在linux下使用curl访问 多参数url GET参数问题
- 使用get和load时的一些小问题
- 使用Get方式传递中文参数的问题乱码问题!
- 在linux下使用curl访问 多参数url GET参数问题
- Hibernate学习笔记(3):session的get、load、delete方法和Query的简单使用
- 使用Get方式传递中文参数的问题乱码问题
- Session的load()和get()方法使用区别:
- UIWebView 使用中遇到的问题(NSURLSession/NSURLConnection HTTP load failed (kCFStreamErrorDomainSSL, -9802))
- 在linux下使用curl访问 多参数url GET参数问题
- ajax使用post提交参数java后台获取值为null但是get却可以获取的问题
- Linux下使用curl命令发送GET请求时多个参数截断的问题
- Session的load()和get()方法使用区别?
- Hibernate : Load get 方法使用 上的一些问题
- 在linux下使用curl访问 多参数url GET参数问题
- 在使用get传递中文参数的编码问题