Why do I get zero results when using OR

I am using Spring Data and JPA (plus Hibernate and MS SQLServer) for my project. I have the following classes stored in tables called class1, class2, and class3.

Class1 {
    Long itemNo;
    Class2: obj2;
    Class3: obj3;
}

Class2 {
    int page;
}

Class3 {
    int page;
}

Note that at any time, one and only one of obj2 or obj3 of objects of Class1 have to be null. So when stored in table class1, either obj2 or obj3 has to be NULL and the other is not.

Here is my query:

@Query("SELECT c1 FROM Class1 c1 WHERE c1.itemNo = :itemNo AND (c1.obj2.page = :page OR c1.obj3.page = :page)")
public List<Class1> getObjects(@Param("itemNo") Long itemNo, @Param("page") int page);

The problem is that this query always returns zero results, even though I can see the records there. What I did is wrong?

Note that I am able to retrieve objects of Class1 separately with the following queries:

@Query("SELECT c1 FROM Class1 c1 WHERE c1.itemNo = :itemNo AND c1.obj2.page = :page") 

and

@Query("SELECT c1 FROM Class1 c1 WHERE c1.itemNo = :itemNo AND c1.obj3.page = :page")