Hibernate version: 3.1.rc2
Name and version of the database you are using:Oracle 9.0.2
I have 2 classes: Father, Son linked with OneToMany.
Now I perform this HQL:
"SELECT s FROM Son s LEFT JOIN FETCH s.father WHERE s.id = 1"
The tables are as followed:
Son:
id father
-- -------
1
Father
id
--
1
now the query works, and I get a Son entity, great.
But what happens when I want to approach the father property? (something like "System.out.println(s.getFather())" ).
If I will try to get the property I get an exception because the Entity with that key doesn't exist.
But all I want is to get an empty value (a null), I don't want the hibernate to run a new select, because I already know there aren't any values in there (because I did a left join).
Is it a bug or is there some workaround?
|