Hi ales,
I posted an answer to the forum. In a nutshell: it is strange that the
second query does not include nulls. It would be great if you could
provide a test case that allows us to reproduce the issue.
Thanks!
Regards Michael
> Hi all,
> please help me if possible. I have the following situation:
>
> - Entity
> - AssociatedEntity
> - Entity has field associatedEntity
> - database table contains many Entity records WITHOUT references to
> AssociatedEntities
> - when I use the following JPA query: SELECT e.associatedEntity.name,
> e.description FROM Entity e WHERE e.description LIKE 'foo' nothing is
> returned (there are Entity descriptions with value foo)
> - when I use the following JPA query: SELECT e.associatedEntity,
> e.description FROM Entity e WHERE e.description LIKE 'foo' nothing is
> returned (there are Entity descriptions with value foo)
> - when I change Entity records to have references to
> AssociatedEntities mentioned queries return data
>
> I do not understand why mentioned queries when Entity records do not
> have references to AssociatedEntities do not return any data. "JSR
> 220: Enterprise JavaBeansTM,Version 3.0" in "4.8.3 Null Values in the
> Query Result" says:
>
> If the result of a query corresponds to a association-field or
> state-field whose value is null, that null
> value is returned in the result of the query method.
>
> IMHO expression "e.associatedEntity" ends with association-field so
> null value should be returned in the result. It seems for me that
> behaviour of the Hibernate framework is the same.
>
> Best regards,
>
> Ales
>
>
> Implementation-Title: TopLink Essentials
> Implementation-Version: 2.0-b43-beta3 (04/18/2007)