Hibernate Mapping exception:-9

Source: Internet
Author: User

if ("true". Equals (Map.get ("isaudited"))) {
Isaudited= "=";//Audited
}else{
Isaudited= "<>";//Pending review
}
String sql = "Select T.origin_district2,t.origin_town2,t.corp_name,t.contact_person,t.mobile_phone,t.corp_type," +
"T.corp_nature2,t.main_prod_type,t.annual_sales,t.address_city2| | t.address_district2| | c.dqmc| | T.address "+
"As Addr,t.regist_time,t.check_status from (select T.*,C.DQMC as Address_district2 from (select T.*,s.name" +
"As CORP_NATURE2,C.DQMC as Address_city2 from (select A.name99 as ORIGIN_DISTRICT2,B.DQJC as ORIGIN_TOWN2," +
"T.corp_name,t.contact_person,t.mobile_phone,s.name as Corp_type,t.corp_nature,t.main_prod_type,t.annual_sales" +
", T.address_city,t.address_district,t.address_town,t.address,t.regist_time, T.check_status from BASE_CORP_INFO" +
"T left joins Sys_data_dict s on T.corp_type=s.data_dict_no left joins Base_coutry A on t.origin_district= (" +
"A.adcode99| |" 000000 ') left join Chongqing_temp B in t.origin_town=b.dqbm where T.check_status "+isaudited+" 3) T left join "+
"Sys_data_dict s on T.corp_nature=s.data_dict_no left joins China_temp C on T.ADDRESS_CITY=C.DQBM) T left" +
"Join China_temp C on T.ADDRESS_DISTRICT=C.DQBM) T left JOIN china_temp C on T.ADDRESS_TOWN=C.DQBM order" +
"By T.origin_district2,t.origin_town2";

Query q=getsession (). createsqlquery (SQL);

Q.list ();

Will throw a map exception

Use a stupid solution:

Query q=getsession (). createsqlquery (SQL). Addscalar ("Origin_district2", Stringtype.instance). Addscalar ("ORIGIN_ TOWN2 ", stringtype.instance)
. Addscalar ("Corp_name", Stringtype.instance). Addscalar ("Contact_person", Stringtype.instance)
. Addscalar ("Mobile_phone", Stringtype.instance). Addscalar ("Corp_type", Stringtype.instance)
. Addscalar ("Corp_nature2", Stringtype.instance). Addscalar ("Main_prod_type", Stringtype.instance)
. Addscalar ("Annual_sales", Stringtype.instance). Addscalar ("addr", stringtype.instance)
. Addscalar ("Regist_time", Stringtype.instance). Addscalar ("Check_status", stringtype.instance);

That is, the type that specifies the return value. Some versions of Hibernate are Hibernate.string,.integer so specified.

Hibernate Mapping exception:-9

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.