paip.hibernate list 返回位null的解决
paip.hibernate list 返回位null的解决
但是size是对的...
里面都是null...
hb3.2版本...oracle11g
=========原因:没主键
也许没主键,看累挂,真的没...
走加上...在myeclipse生成...走ok兰...发现生成的pojo和没主键的时候儿也不一样...
作者 老哇的爪子 Attilax 艾龙, EMAIL:1466519819@qq.com
来源: http://blog.csdn.net/attilax
// Fields
private Long id;
private Long vdnid;
private Long userid;
private Long confkbstypepid;
private Long departmentid;
private Long grpsubsitepid;
private String question;
private String keyword;
private String answer;
private Long belong;
// Property accessors
@GenericGenerator(name = "generator", strategy = "increment")
@Id
@GeneratedValue(generator = "generator")
@Column(name = "ID", unique = true, nullable = false, precision = 22, scale = 0)
public Long getId() {
return this.id;
}
要是没主键,走弄个..
// Fields
private TConfKbsId id;
// Property accessors
@EmbeddedId
@AttributeOverrides( {
@AttributeOverride(name = "vdnid", column = @Column(name = "VDNID", precision = 22, scale = 0)),
@AttributeOverride(name = "userid", column = @Column(name = "USERID", precision = 22, scale = 0)),
@AttributeOverride(name = "confkbstypepid", column = @Column(name = "CONFKBSTYPEPID", precision = 22, scale = 0)),
@AttributeOverride(name = "departmentid", column = @Column(name = "DEPARTMENTID", precision = 22, scale = 0)),
@AttributeOverride(name = "grpsubsitepid", column = @Column(name = "GRPSUBSITEPID", precision = 22, scale = 0)),
@AttributeOverride(name = "id", column = @Column(name = "ID", precision = 22, scale = 0)),
@AttributeOverride(name = "question", column = @Column(name = "QUESTION", length = 2048)),
@AttributeOverride(name = "keyword", column = @Column(name = "KEYWORD", length = 2048)),
@AttributeOverride(name = "answer", column = @Column(name = "ANSWER", length = 1096)),
@AttributeOverride(name = "belong", column = @Column(name = "BELONG", precision = 22, scale = 0)) })
public TConfKbsId getId() {
return this.id;
}
参考
hibernate 查询视图返回list为null的解决方法 2013-01-08 16:12:37
分类: Linux
hibernate查询视图时,会将视图的所有字段作为主键,如果存在为空字段则返回值就为空,也就查询不到相应的结果。myeclipse反转工具生成的实体包含两个表,一个表是EntPriWarQueryId,一个表是EntPriWarQuery,处理方法如下:
1.把此表EntPriWarQuery当做普通的表处理,增加主键及主键生成策略,还有相关的get和set方法,也就是说把该表处理成普通的实体;
2.在创建视图时把可能为空的字段做处理,forexampl:
case when p.fileno is null then '0'
else p.fileno
end as fileno,
是为空的字段有值即可;
paip.hibernate list 返回位null的解决的更多相关文章
- paip.hibernate save 失败的解决
paip.hibernate save 失败的解决 打开log debug level,,看不见insert 代码... Hibernate select max(ID).txt ...
- paip.Log4j配置不起作用的解决
paip.Log4j配置不起作用的解决 1.jar包里的log4j配置 看累挂jar,真的有个" webservices-rt.jar\com\sun\org\apache\xml\inte ...
- 安装J2EE的SDK报错:could not find the required version of the Java(TM)2 Runtime Environment in '(null)'的解决办法。
国内私募机构九鼎控股打造APP,来就送 20元现金领取地址:http://jdb.jiudingcapital.com/phone.html内部邀请码:C8E245J (不写邀请码,没有现金送)国内私 ...
- Type.GetType()在跨程序集反射时返回null的解决方法
在开发中,经常会遇到这种情况,在程序集A.dll中需要反射程序集B.dll中的类型.如果使用稍有不慎,就会产生运行时错误.例如使用Type.GetType("BNameSpace.Class ...
- paip. everything exe 文件不能启动的解决
paip. everything exe 文件不能启动的解决 作者Attilax , EMAIL:1466519819@qq.com 来源:attilax的专栏 地址:http://blo ...
- wince下GetManifestResourceStream得到的Stream是null的解决
问题的引入 在编程过程中遇到下面这样一个问题: 有这样一个方法: public static AlphaImage CreateFromResource(string imageResourceNam ...
- SSH项目web.xml文件的常用配置【struts2的过滤器、spring监听器、解决Hibernate延迟加载问题的过滤器、解决中文乱码的过滤器】
配置web.xml(struts2的过滤器.spring监听器.解决Hibernate延迟加载问题的过滤器.解决中文乱码的过滤器) <!-- 解决中文乱码问题 --> <filter ...
- 多线程中使用HttpContext.Current为null的解决办法
HttpContext.Current.Server.MapPath(logFile) 这个是得到具体路径的方法 正常情况下是可以的 多线程情况下就为null 下边的代码原本的作用是把网站的异常 ...
- java.lang.IllegalArgumentException: The observer is null.终于解决方式
java.lang.IllegalArgumentException: The observer is null.终于解决方式 在使用数据适配的时候的问题: java.lang.IllegalArgu ...
随机推荐
- java break语句的三种用法
1.用于switch语句当中,用于终止语句 2.用于跳出循环,此为不带标签的break语句,相当与goto的作用 e.g while(i<j&&h<k){ if(h< ...
- datagridview中使用checkbox问题。
如果套用datagridview中的checkboxfield,生成的数据,会出现无法选择datagridview中数据项的问题,即checkbox不可以被鼠标点击,选中/取消选中.此checkbox ...
- jQuery2
一.类型选择器 jQuery的类型选择器 选择器 说明 :button 选择所有按钮 :checkbox 选择所有复选框 :file 选择所有文件上传输入框 :header 选择所有标题元素(h1,h ...
- 选择合适的String拼接方法(这篇博客是我抄的)
package com.test; public class FreeFile { public static void main(String[] args) { // 加号拼接 String st ...
- mysql root 密码丢失问题
root密码丢失,我们需要将mysql以不检查权限的方式重新启动. 在mysql的配置文件(/etc/my.cnf)中,[mysqld]下添加一句skip-grant-tables,然后重新启动服务, ...
- document.referrer 特性
最近需要用到document.referrer,但是在测试的时候,总是获取为空,百思不得其解. 于是发动百度,看了大量的文章没有一个说到点子上是为什么,后来偶然看到document.referrer ...
- iOS(OC)中的冒泡排序
NSMutableArray *array = [NSMutableArray arrayWithObjects:@"12",@"84", @"35& ...
- linux开启oracle服务
linux下启动oracle su - oracle sqlplus /nolog conn /as sysdba startup exit lsnrctl start exit 2. linux下关 ...
- 多重背包 (poj 1014)
题目:Dividing 题意:6种重量的的石头,每个给定数量,用总重的一半去装,问能否装满. #include <iostream> #include <algorithm> ...
- jQuery学习总结(二)
简单选择器: 在使用jQuery 选择器时,我们首先必须使用“$()”函数来包装我们的CSS 规则. 而CSS 规则作为参数传递到jQuery 对象内部后,再返回包含页面中对应元素的jQuery 对象 ...