findOne
Used when a query is expected to return 1 or zero beans.
Contact contact =
new QContact()
.email.equalTo("rob@foo.bar")
.findOne();
findOneOrEmpty
The same as findOne but returns an Optional
holding the bean.
Optional<Contact> contact =
new QContact()
.email.equalTo("rob@foo.bar")
.findOneOrEmpty();
These methods throw jakarata.persistence.NonUniqueResultException
if there is more that one matching
result for the query.