I'll try to explain what is mysteriously happening.
A bug was found in the test environment that simply don't reproduce in the development environment. A query in the test environment database returns nothing but when I restored the database backup of the test environment on my machine it did return a result.
For running the app connecting on the test environment database I could reproduce the bug, so we thought the bug could be related to something in the database server (since it did work before being formatted a short time from now) or Hibernate.
I extract the query generated by Hibernate and used it with JBDC PreparedStatement, but the bug still remains.
The query used is below:
Thus not return anything:
Note: If we run it straight into manager sql server returns the value 1
Thus returns the value that actually is correct: 1
Thus returns the value of real fact
The problem is only with SQL Server and in very specific situations. Someone already encountered this, or something?