{"record":{"id":"6f6fc85a3923d128","repo":"quarkusio/quarkus","slug":"incorrect-description-i3-getdescription","errorCode":null,"errorMessage":"Incorrect description: \" + i3.getDescription() + \", expected: \" + expectedDesc[2]","messagePattern":"Incorrect description: \" \\+ i3\\.getDescription\\(\\) \\+ \", expected: \" \\+ expectedDesc\\[2\\]","errorType":"exception","errorClass":"RuntimeException","httpStatus":500,"severity":"error","filePath":"integration-tests/hibernate-orm-cache/src/main/java/io/quarkus/it/hibernate/orm/cache/HibernateOrmCacheTestEndpoint.java","lineNumber":374,"sourceCode":"        QuarkusTransaction.requiringNew().run(() -> {\n            findByIdItems(em, expectedDesc);\n        });\n\n        assertRegionStats(expected, Item.class.getName());\n    }\n\n    private static void findByIdItems(EntityManager em, String[] expectedDesc) {\n        final Item i1 = em.find(Item.class, 1L);\n        if (!i1.getDescription().equals(expectedDesc[0]))\n            throw new RuntimeException(\"Incorrect description: \" + i1.getDescription() + \", expected: \" + expectedDesc[0]);\n\n        final Item i2 = em.find(Item.class, 2L);\n        if (!i2.getDescription().equals(expectedDesc[1]))\n            throw new RuntimeException(\"Incorrect description: \" + i2.getDescription() + \", expected: \" + expectedDesc[1]);\n\n        final Item i3 = em.find(Item.class, 3L);\n        if (!i3.getDescription().equals(expectedDesc[2]))\n            throw new RuntimeException(\"Incorrect description: \" + i3.getDescription() + \", expected: \" + expectedDesc[2]);\n\n        List<Item> allitems = Arrays.asList(i1, i2, i3);\n        if (allitems.size() != 3) {\n            throw new RuntimeException(\"Incorrect number of results\");\n        }\n        StringBuilder sb = new StringBuilder(\"list of stored Items names:\\n\\t\");\n        for (Item p : allitems)\n            p.describeFully(sb);\n\n        sb.append(\"\\nList complete.\\n\");\n        System.out.print(sb);\n    }\n\n    private void testQuery() {\n        //Load all persons and run some checks on the query results:\n        Map<String, Counts> counts = new TreeMap<>();\n        counts.put(Person.class.getName(), new Counts(4, 0, 0, 4));\n        counts.put(RegionFactory.DEFAULT_QUERY_RESULTS_REGION_UNQUALIFIED_NAME, new Counts(1, 0, 1, 1));","sourceCodeStart":356,"sourceCodeEnd":392,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/integration-tests/hibernate-orm-cache/src/main/java/io/quarkus/it/hibernate/orm/cache/HibernateOrmCacheTestEndpoint.java#L356-L392","documentation":"Same assertion pattern for the third Item (id=3): em.find(Item.class, 3L) must return an Item whose description equals expectedDesc[2], otherwise this RuntimeException is thrown. Part of the Item entity-cache verification that all three cached items match the expected descriptions.","triggerScenarios":"Verifying cached Items when Item 3's cached or persisted description differs from expectedDesc[2] — stale cache after updates, prior-run mutations, or wrong seed data.","commonSituations":"Entity cache retaining pre-update descriptions; Item 3 changed by a previous failed run; expected values in the caller not matching the seed/update logic.","solutions":["Evict the Item entity region before verification","Reset seed data to guarantee Item 3's description matches expectedDesc[2]","Trace whether the update phase persisted the new description for Item 3","Clear the cache and rerun to distinguish cache staleness from data issues"],"exampleFix":"// before\nfinal Item i3 = em.find(Item.class, 3L);\nif (!i3.getDescription().equals(expectedDesc[2])) throw ...\n// after\nsessionFactory.getCache().evict(Item.class);\nfinal Item i3 = em.find(Item.class, 3L);\nif (!i3.getDescription().equals(expectedDesc[2])) throw ...","handlingStrategy":"validation","validationCode":"sessionFactory.getCache().evict(Item.class);\nItem i3 = em.find(Item.class, 3L);\nif (i3 == null) throw new IllegalStateException(\"Item 3 not seeded\");","typeGuard":null,"tryCatchPattern":"try {\n    findByIdItems(em, expectedDesc);\n} catch (RuntimeException e) {\n    sessionFactory.getCache().evict(Item.class);\n    // reload; persistent mismatch indicates a seed/update bug\n}","preventionTips":["Confirm the update phase actually persisted Item 3's new description","Evict the Item region between phases","Keep seed, expected, and update values in one constants class"],"tags":["hibernate","entity-cache","second-level-cache","test-assertion","quarkus"],"backgroundTag":"stale-cache-data","analyzedSha":"e1c734241f34c7919086ceb4c9262b4a58f6de44","analyzedAt":"2026-09-05T17:01:29.979Z","contentChangedAt":"2026-09-05T17:01:29.979Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}