0

I have 3 entities

A,B and C

with one to one relation between A and B
many to one relation between B and C

When I access entity 'A', I am able to drill down and get the values of C

However when I have a nested condition in my HQL, I get null pointer exception

Query looks like

from(A) where A.B.C.some_parameter.eq(value)

I have added

<property name="hibernate.max_fetch_depth" value="4" />

in my configuration, but still I keep getting Null pointer exception

1
  • Mind posting a stack-trace excerpt? Commented Jun 1, 2012 at 9:17

2 Answers 2

0

Thats not even remotely valid HQL :)

1) You do not wrap entity references in parenthesis; its just from A

2) You want to further dereference that A reference, so typically you would alias it like from A a

3) Assuming .eq is an attempt to perform equality comparison, its where a.b.c.someProperty = value

4) fetch_depth has absolutely no bearing here.

Sign up to request clarification or add additional context in comments.

Comments

0

The query should be..

"from A a where a.B.C.some_parameter = value"

check the reference, Hibernate Lazy must be false between A, B and C. The property you have defined I don't think that has any dependency on your desire. Also for the entity you executing the query must have complete bridge from A to C and C's property you are using in where clause.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.