The generated request from Hibernate (except that I replaced the list of fields with *):
select * from resource resource0_, resourceOrganization resourceor1_ where resource0_.active=1 and resource0_.published=1 and ( resource0_.resourcePublic=1 or resourceor1_.resource_id=resource0_.id and resourceor1_.organization_id=2 and ( resourceor1_.resource_id=resource0_.id and resourceor1_.forever=1 or resourceor1_.resource_id=resource0_.id and ( current_date between resourceor1_.startDate and resourceor1_.endDate ) ) )
Currently, I have 200+ entries in both Windows and Linux databases, and currently the following is done for each entry: active = 1 published = 1 resourcePublic = 1
When I run this directly in the SQL client, this SQL query gets me all the relevant records in Windows, but not one of them in Linux. I have MySQL 5.1 on both Windows and Linux.
If I apply logical logic (true and true and (true or something else)), I expect the result to be true. This is true for Windows, but false for Linux !!!
If I modify the query as follows, it works on both Windows and Linux:
select * from resource resource0_ where resource0_.active=1 and resource0_.published=1 and ( resource0_.resourcePublic=1 )
So, only the presence of conditions related to resourceOrganization leads to the fact that the query returns 0 results in Linux, and I expected that since this is the second part of the βorβ condition, the first part of which is true, the result should be true.
Any idea why this difference in behavior between the two OSs and why something that should obviously work on Linux doesn't work!
Thanks in advance!
source share