Reputation: 165
While fetching all the entries from database it returns an ArrayList with error all elements cannot be null.
But when I fetch query with select one or one + elements, it returns the proper arraylist.
I tried but didn't find any useful working answer.
Thanks,
String String = "from abc rfi " +
"where rfi.a=:carrier " +
"and rfi.b=:fileStatus " +
"and rfi.c=:fileType ";
Query query = session.createQuery(queryString);
query.setParameter("fileStatus", fileStatus.value());
query.setParameter("carrier", carrier.value());
query.setParameter("fileType", fileType);
Upvotes: 1
Views: 411
Reputation: 129
Since you said you filled all the data so just another check you can do. In your query, you add the values in where clause -
query.setParameter("fileStatus", fileStatus.value());
Is fileStatus
is enum
? If yes, are you sure you get the expected value from fileStatus.value()
or data in DB exist with fileStatus.name()
Upvotes: 0
Reputation: 57
Hibernate may return all elements as null even if a single field of the primary key in the result is null.
Upvotes: 1