quarkusio/quarkus · error · RuntimeException

Person Quarkus doesn't exist when it should

Error message

Person Quarkus doesn't exist when it should

What it means

This integration-test endpoint verifies seeded data by executing raw JDBC (PreparedStatement with setObject("Quarkus")) and expects at least one Person row named 'Quarkus'; if the result set is empty it throws this RuntimeException. It means the test fixture data was not persisted/committed or is not visible to the connection.

Source

Thrown at integration-tests/jpa-mariadb/src/main/java/io/quarkus/it/jpa/mariadb/JPAFunctionalityTestEndpoint.java:79

            }
            if (!allpersons.get(0).getName().equals("Gizmo")) {
                throw new RuntimeException("Incorrect order of results");
            }
            StringBuilder sb = new StringBuilder("list of stored Person names:\n\t");
            for (Person p : allpersons) {
                p.describeFully(sb);
            }
            sb.append("\nList complete.\n");
            System.out.print(sb);
        });

        //Try to use prepared statement with setObject:
        try (PreparedStatement ps = ds.getConnection().prepareStatement("select * from Person as p where p.name = ?")) {
            ps.setObject(1, "Quarkus");
            final ResultSet resultSet = ps.executeQuery();

            if (!resultSet.next()) {
                throw new RuntimeException("Person Quarkus doesn't exist when it should");
            }
        }

        //Try a JPA named query:
        QuarkusTransaction.requiringNew().run(() -> {
            TypedQuery<Person> typedQuery = em.createNamedQuery(
                    "get_person_by_name", Person.class);
            typedQuery.setParameter("name", "Quarkus");
            final Person singleResult = typedQuery.getSingleResult();

            if (!singleResult.getName().equals("Quarkus")) {
                throw new RuntimeException("Wrong result from named JPA query");
            }
        });

        //Check that HQL fetch does not throw an exception
        QuarkusTransaction.requiringNew()
                .run(() -> em.createQuery("from Person p left join fetch p.address a").getResultList());

View on GitHub (pinned to e1c734241f)

Solutions

  1. Confirm the seed transaction that persists Person 'Quarkus' committed before the query runs
  2. Verify quarkus.datasource.jdbc.url points at the database where the data was inserted
  3. Check container/test data setup ran (docker/MariaDB testcontainer up, schema created)
  4. Re-run cleanUpData + persist step, then verify with a direct SQL client
Defensive patterns

Strategy: try-catch

Validate before calling

try (Connection c = ds.getConnection();
     PreparedStatement ps = c.prepareStatement("select count(*) from Person where name = ?")) {
    ps.setString(1, "Quarkus");
    try (ResultSet rs = ps.executeQuery()) {
        rs.next();
        if (rs.getInt(1) == 0) throw new IllegalStateException("Seed data missing: Person 'Quarkus'");
    }
}

Try / catch

try {
    runEndpointTest();
} catch (RuntimeException e) {
    if (e.getMessage().contains("Person Quarkus doesn't exist")) {
        // re-seed data / verify datasource URL, then retry once
    }
}

Prevention

When it happens

Trigger: GET the endpoint when the Person 'Quarkus' insert never ran, rolled back, or was written to another database/schema than the DataSource used for the select.

Common situations: Database not initialized or flyway/seed scripts missing; pointing quarkus.datasource at the wrong MariaDB database/container; transaction isolation or a rolled-back transaction hiding the insert; cleanup from a previous test run deleted the row.

Related errors


AI-assisted analysis of quarkusio/quarkus@e1c734241f (2026-09-05). Data as JSON: /api/errors/2b6387b14d25f6d3. Report an issue: GitHub.