문제

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?

도움이 되었습니까?

해결책

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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top