Hibernate Query Problem

I was facing a wired problem that is I'm constructing Hibernate criteria and I have added some constraints to it and then called the criteria.uniqueResult(); it sometimes return results and sometimes return null, however if you take the generated query and execute it against the database it will return result to you.

 and this drive me crazy, so I decided to change the methoduniqueResult() and used criteria.list()

and when I debugged the returned list it contains the accurate size but when you try invoke list.get(0) it returns null.

for the first moment I thought that Hibernate code contains bug, but after some tracing I discovered that the problem cause was that the records that always return null has null ID.

Hibernate didn't throw any meaningfull message/exception related to this issue only it returns null, I guess this is wiered.

There are so many common

There are so many common problems of that in the net. That is usually the best deals to take a look into. - Dennis Wong YOR Health

Powered by Drupal - Design by artinet