NamedParameterInformationImpl cannot be cast to java.util.ArrayList

USING Hibernate 5.6.9.Final

I got the following error on the line queryObj.list()

java.lang.ClassCastException: org.hibernate.hql.internal.classic.NamedParameterInformationImpl cannot be cast to java.util.ArrayList

The code is the following

String query = "select tb FROM TAB_1 sb inner join sb.indexes as tb where CONVERT(DATE,sb.v_date) = :odate";
Query queryObj = dao.createQuery(query);
queryObj.setParameter(odate, new SimpleDateFormat("yyyy-MM-dd").format("2022-05-01");
List = queryObj.list();

If I use

  new Date()

instead of a specific date, it returns 0 result. Also for other dates, I get 0 result. But for dates that should return results, I get the exception.

The code snippet you posted here is not valid Java code, so I have no idea what you are really executing. I also need to see the full stack trace.

Okay. This is a the query

select tb FROM TAB_1 sb inner join sb.indexes as tb where CONVERT(DATE,sb.v_date) = :odate

If I do this it works

select tb FROM TAB_1 sb inner join sb.indexes as tb where CONVERT(DATE,sb.v_date) = '2020-10-10'

I spent times debugging and found that data is fetched but the casting fails in this method
org.hibernate.loader.initializeEntitiesandCollections

Here is a full stack track. Deleted lines contain the described method path.

2nd image in next comment
Hibernate properties in next comment

Hibernate properties in next comment

hibernate properties

PS: metamodel population is disabled as I got the issue “expecting Id class” , disabling it fixed it.

xml config:

That is not a full stack trace. In the first picture, there are <15 internal calls> which are relevant here. Also, stop posting pictures and post formatted text instead.

(post deleted by author)

In fact it is on my work pc and I don’t have the right to login here, share files or send mails that’s why I shared images.
I can only see this way to share my stack.

If you allow it, here is logs + ( added xml config in my last comment)

Thanks

Don’t use the org.hibernate.hql.internal.classic.QueryTranslatorImpl. Remove the configuration of the hibernate.query.factory_class