Java.lang.ClassCastException:java.lang.String cannot is cast to Com.jy.hfims.domain mapping entity type error

Source: Internet
Author: User

Today, when doing Excel export, there is a problem "java.lang.ClassCastException:java.lang.String cannot is cast to com.domain.xxx";

Company with hibernate, query when you can use SQL and HQL, with what general mood, the first query with the Select g.* from Persion G, site S where G.wz=s.dz (of course, are abbreviated);

The error "Java.lang.ClassCastException:java.lang.String cannot is cast to Com.domain.xxx" appears when the Get entity is exported;

Because of the two tables, it is suspected that the bottom of our company SQL query statement problem, not the query out of the statement to strongly turn;

I also did not change the bottom of the company, changed to HQL query;

Select G.node,g.type from Persion G, site S where G.wz=s.dz;

Check the fields I need, or there is this error.

Later thought might not find the corresponding table, changed to query all the fields, select G from Persion G, site S where G.wz=s.dz;

The select is followed by an alias to query the name of the table, and it's OK to find the problem.

Because it is new, record, expect to be able to use later, also can help to meet the same problem person.

Java.lang.ClassCastException:java.lang.String cannot is cast to Com.jy.hfims.domain mapping entity type error

Related Article

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.