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