Quantcast
Channel: Spring Community Forums - Data
Viewing all articles
Browse latest Browse all 297

How come my LIMIT 1 clause returns a collection of 2 objects

$
0
0
Hi,

I have a finder which shoud return only one object but instead tries to return a collection of two objects.

Here is how the finder looks like:
Code:

    @Query("SELECT cr FROM ContactReferer cr ORDER BY cr.listOrder ASC LIMIT 1")
    public ContactReferer findFirst();

Here is what the console log shows:
Quote:

select contactref0_.id as id34_, contactref0_.version as version34_, contactref0_.description as descript3_34_, contactref0_.list_order as list4_34_ from contact_referer contactref0_ order by contactref0_.list_order ASC limit 2
My test is simple:
Code:

    ContactReferer loadedContactReferer = contactRefererRepository.findFirst();
    assertEquals(contactReferer1.getDescription(), loadedContactReferer.getDescription());

Any clue ?

Kind Regards,

Stephane

Viewing all articles
Browse latest Browse all 297

Trending Articles