I am getting a class cast exception with hibernate when trying to cast the result set to the mapping class... I am able to see the data in the result set that is returned...howe
For tests I recommend you to put a try-catch clause around the statement which is producing the class cast exception, set a breakpoint in the catch block and look which class the i-th element really is.
To your problem:
You are using the HQL SELECT
statement. The query with this statement returns a list, but the elements of the list are not necessarily instances of EQP_TU; they also can be an array of object.
Solution for you:
Use the FROM
statement instead of the SELECT
statement. In your code:
String queryString = "FROM EQP_UT AS A " +
"LEFT JOIN A.eqp_comp AS B " +
"WHERE A.INITIAL||A.NUMBER IN (:carList) AND A.INITIAL IN (:initList) AND A.NUMBER IN (:numberList) " +
"AND B.TRUK_AXL_CNT > 0";
Then you can be sure to get a list with instances of the class you mentioned after FROM (EQP_UT in your code).