hibernage 报不能转换成 对象
来源:互联网 发布:淘宝搜索店铺名找不到 编辑:程序博客网 时间:2024/06/06 00:02
首先你要在你的类中写好,这个,供映射用的
public User(){}
public User(String phone,String address,Long id){
this.phone=phone;
this.address=address;
this.id=id;
}
然后在你的hibernate查询语句,写上这个,,,,这里你是转为一个User对象,所以结果要是唯一的
String hql = "select new User(phone,address) from User u where u.id='"+id+"'";
Query query = (Query) this.getSession().createQuery(hql);
return (User) query.uniqueResult();
0 0
- hibernage 报不能转换成 对象
- hibernage
- C#程序中报“对象不能从 DBNull 转换为其他类型”错误
- 报错:toArray 不能转换为 String[]
- List转换成JSON对象报错(一)
- List转换成JSON对象报错(二)
- List转换成JSON对象报错(三)
- List转换成JSON对象报错(四)
- List转换成JSON对象报错(五)
- 对象引用前加const报错:不能将“this”指针从“const a”转换为“a
- 对象引用前加const报错:不能将“this”指针从“const a”转换为“a
- 对象引用前加const报错:不能将“this”指针从“const a”转换为“a
- 对象引用前加const报错:不能将“this”指针从“const a”转换为“a
- c++;对象引用前加const报错:不能将“this”指针从“const a”转换为“a &”
- 父类对象不能强行转换为子类对象
- excel报“不能使用对象链接和嵌入”的解决方法
- 编译模板类报编译错误 不能解析外部对象
- IE中JS报"automation 服务器不能创建对象"错误
- netty客户端异步获取数据
- Linux——网络配置相关命令
- HDU 2059 龟兔赛跑
- 【随手写】JS过滤所有script正则
- android Eclipse插件下载sdk代理
- hibernage 报不能转换成 对象
- 关于Zernike矩
- Insertion Sort List(leetcode)
- MyEclipse基本设置
- android 常用的命令和工具
- android binder - 客户端(java层) 调用 服务端(c++层) 例子
- 2014世界互联网乌镇峰会 马云演讲实录
- C#DateTimePicker用法
- app第一次运行滑动视图