paip.hibernatelist返回位null的解决
程序员文章站
2022-06-04 11:39:06
...
paip.hibernate list 返回位null的解决 但是size是对的... 里面都是null... hb3.2版本...oracle11g =========原因:没主键 也许没主键,看累挂,真的没... 走加上...在myeclipse生成...走ok兰...发现生成的pojo和没主键的时候儿也不一样... 作者 老哇
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,
是为空的字段有值即可;
下一篇: PHP4新函数集锦_PHP
推荐阅读
-
解决js相同的正则多次调用test()返回的值却不同的问题
-
JQuery异步获取返回值中文乱码的解决方法
-
解决axios发送post请求返回400状态码的问题
-
64位系统中IIS7运行ASP时出现ADODB.Connection 800a0e7a错误的解决方法
-
win7 64位下运行Virtualbox安装系统时出错(提示VBoxDD.DLL错误)的解决方法
-
VirtualBox或VM Ware只能安装32位系统的解决方法
-
request.getParameter()取值为null的解决方法
-
64位win7系统中iis7报80004005错误的解决方法
-
关于axios返回空对象的问题解决
-
基于vue 添加axios组件,解决post传参数为null的问题