-
Notifications
You must be signed in to change notification settings - Fork 176
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
JPQL query for all entities in descending order returns no results on Oracle #2339
Comments
I see no issue on Eclipselink side. Here is small application with few tests to verify your scenario: |
Hi @Tomas-Kraus I tried in JPA , but still getting the issue. Please check recreate details in this PR OpenLiberty/open-liberty#30595 |
Entity: @Entity
public class Package {
public String description;
@Id
public int id;
public float height;
public float length;
public float width;
public static Package of(int id, float length, float width, float height, String description) {
Package inst = new Package();
inst.id = id;
inst.length = length;
inst.width = width;
inst.height = height;
inst.description = description;
return inst;
}
@Override
public String toString() {
return "Package id=" + id + "; L=" + length + "; W=" + width + "; H=" + height + " " + description;
}
} Test case : @Test
@Ignore
//Reference issue : https://github.com/OpenLiberty/open-liberty/issues/30444
public void testOLGH30444() throws Exception {
deleteAllEntities(Package.class);
Package p1 = Package.of(1, 1.0f, 1.0f, 1.0f, "testOLGH28545-1");
Package p2 = Package.of(2, 1.0f, 2.0f, 1.0f, "testOLGH28545-2");
List<Integer> results;
tx.begin();
em.persist(p1);
em.persist(p2);
tx.commit();
tx.begin();
try {
results = em.createQuery("SELECT ID FROM Package ORDER BY WIDTH DESC", Integer.class)
.setLockMode(LockModeType.PESSIMISTIC_WRITE)
.setMaxResults(1)
.getResultList();
tx.commit();
} catch (Exception e) {
tx.rollback();
throw e;
}
assertEquals(1, results.size());
assertEquals(2, results.get(0).intValue());
} |
A Jakarta Data test fails with,
After persisting a number of entities, Jakarta Data sent the following JPQL:
EclipseLink turned this into a SQL query that didn't produce any results:
Also, a second Jakarta Data test fails similarly,
In this test, Jakarta Data persists entities and then sends the following JPQL:
EclipseLink turns this into a SQL query and finds no results:
It should be noted that the City entity has an @IdClass(CityId.class) where CityId has String fields: name, stateName corresponding to fields of the City entity:
The text was updated successfully, but these errors were encountered: