Hibernate Criteria query is running very slow

Hi @satluri,

Not very familiar with Oracle so it’s more a general remark: what could happen is that in the case of the Hibernate Query, the query is passed without the parameters values so the plan chosen might be too generic and totally ineffective.

When you execute your query from the CLI, you pass the parameter directly so it’s more effective.

I know PostgreSQL used to have this problem at some point but it was solved at some point.

The issue is not really with Hibernate here, you need to understand why Oracle is choosing a suboptimal plan in the prepared statement case.