Reputation: 755
session.createQuery("select ccrd.createdDate , s1 "
+ "from CrComponentRelDependency ccrd "
+ "left outer join ccrd.crComponentDependencyDtls s1 "
+ "where ccrd.crComponent.componentSeq= :COMPONENT_SEQ "
+ "and (ccrd.referencedComponentVer IS NULL) "
.setParameter("COMPONENT_SEQ", componentId);
This query is giving valid values for ccrd.createdDate , but it is returning NULL for s1 entity. I have defined a one-to-one relation between CrComponentRelDependency & crComponentDependencyDtls.
Upvotes: 1
Views: 1129
Reputation: 425083
HQL does all the joining for you, so don't explicitly join tables. Try this:
session.createQuery("select createdDate, crComponentDependencyDtls "
+ "from CrComponentRelDependency ccrd "
+ "where crComponent.componentSeq = :COMPONENT_SEQ "
+ "and referencedComponentVer IS NULL")
.setParameter("COMPONENT_SEQ", componentId);
Note also the removal of unnecessary qualification and brackets from your HQL.
Upvotes: 1