Reputation: 6040
so i have a HQL code in Java that does
ClassA myAObj = null;
myAObj = (ClassA) hs.get(ClassA.class, classId)
this line executes without issue many times. however, there are cases for a few primary key ID where HQL return a null value and myAObj is null. This is considered odd because i took the console's SQL equivalent scriptand ran it in SQL developer and i did not get a null result.
What is the possible cause of this?
Upvotes: 0
Views: 155
Reputation: 26084
The classId
you are passing to hs.get(ClassA.class, classId)
is not present(not matching) in your table records.
Better you debug code or print classId
value then verify that record exist in your table.
Upvotes: 1