You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@deltaspike.apache.org by "Gerhard Petracek (JIRA)" <ji...@apache.org> on 2013/10/27 21:49:31 UTC

[jira] [Updated] (DELTASPIKE-421) Find zero or one

     [ https://issues.apache.org/jira/browse/DELTASPIKE-421?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Gerhard Petracek updated DELTASPIKE-421:
----------------------------------------

    Assignee: Thomas Hug

> Find zero or one
> ----------------
>
>                 Key: DELTASPIKE-421
>                 URL: https://issues.apache.org/jira/browse/DELTASPIKE-421
>             Project: DeltaSpike
>          Issue Type: New Feature
>          Components: Data-Module
>    Affects Versions: 0.5
>            Reporter: Harald Wellmann
>            Assignee: Thomas Hug
>
> At the moment,
> E findByFoo(T foo)
> behaves like Query.getSingleResult(), i.e. it throws an exception if there is no result or more than one result.
> Dealing with these exceptions is inconvenient when the semantics required by the user is "find zero or one" or "find any one".
> These cases should be supported by
> E findOptionalByFoo(T foo)
> which
> - returns null when there is no result
> - returns the single result when there is exactly one result
> - throws NonUniqueResultException when there is more than one result
> and
> E findAnyByFoo(T foo)
> which
> - returns null when there is no result
> - returns the first result otherwise



--
This message was sent by Atlassian JIRA
(v6.1#6144)