Paip. hibernatelist

Source: Internet
Author: User
Paip. hibernatelist solves the problem of returning null bits, but the size is correct... all of them are null... hb3.2 version... oracle11g ========= cause: If there is no primary key, maybe there is no primary key. If you are tired of reading it, there is really no... add... generate... In myeclipse... go to OK... it is found that the generated pojo is different from the one without a primary key... author's old wow

Paip. solve the problem of returning null bits in hibernate list, but the size is correct... all of them are null... hb3.2 version... oracle11g ========= cause: If there is no primary key, maybe there is no primary key. If you are tired of reading it, there is really no... add... generate... In myeclipse... go to OK... it is found that the generated pojo is different from the one without a primary key... author's old wow

Solution for null bits returned by paip. hibernate list
But the size is correct...

All of them are null...

Hb3.2... oracle11g
========= Cause: no primary key

Maybe you don't have a primary key. Check if you are tired...
Add... generated in myeclipse... Go to OK... and find that the generated pojo is different from the one without a primary key...
Author old wow's paw Attilax iron, EMAIL: 1466519819@qq.com
Source: http://blog.csdn.net/attilax
// Fields

Private Long id;
Private Long vdnid;
Private Long userid;
Private Long confkbstypepid;
Private Long extends mentid;
Private Long maid ID;
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;
}


If there is no primary key, let's get one ..
// 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 = "maid", column = @ Column (name = "maid", 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;
}

Reference

Solution to returning list as null in The hibernate query view 16:12:37

Category: Linux

When hibernate queries a view, all fields in the view are used as the primary key. If there are null fields, the return value is null, and the corresponding results cannot be queried. The entity generated by myeclipse reversal tool contains two tables, one of which is EntPriWarQueryId and the other is EntPriWarQuery. The processing method is as follows:
1. Use EntPriWarQuery as a normal table, add a primary key and primary key generation policy, and related get and set methods, that is, process the table as a normal object;
2. When creating a view, process fields that may be null. forexampl:
Case when p. fileno is null then '0'
Else p. fileno
End as fileno,
It is null and the field has a value;

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.