Question

In my application I am hitting DB using JPA (With Hibernate as JPA Provider). When I try to run a query, system provides me empty result list. But when I run SQL representation of same query (taken from logs), it runs fine and provides me correct results.

Can someone please help me in understanding what can be the possible issue here?

Was it helpful?

Solution

The issue is probably with the parameter values. Do you use any parameter of a type that requires some inference from the provider (like an enum)? I've seen a complex JPQL query for which Hibernate 3.3 wasn't able to infer the type of an enum (Number or String) for an entity attribute because the entity attribute wasn't qualified with the entity alias in the query (entityAttribute instead of alias.entityAttribute). The enum was set as a parameter in its serialized form. Like @Gimby said, you can check the full Hibernate logs to see what are the real values set as parameters.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top