Uploaded image for project: 'Spring Data Commons'
  1. Spring Data Commons
  2. DATACMNS-1005

Javaslang collections cannot be returned from paginating query methods

    XMLWordPrintable

    Details

      Description

      With the release of Ingalls, JavaSlang types (collections and Option) can be returned directly from spring-data @Repository - annotated components. Unfortunately, it turns out that if a in-@Repository-defined method has an argument of type @Pageable application fails at startup because of the following exception:

      Caused by: java.lang.IllegalStateException: Method has to have one of the following return types! [interface org.springframework.data.domain.Slice, interface org.springframework.data.domain.Page, interface java.util.List]
      	at org.springframework.data.repository.util.ClassUtils.assertReturnTypeAssignable(ClassUtils.java:120)
      	at org.springframework.data.repository.query.QueryMethod.<init>(QueryMethod.java:81)
      

      The following piece of code illustrates the problem:

      interface EmailMessageRepository extends Repository<EmailMessage, Long> {
      
          List<EmailMessage> findBySentIsNull(Pageable pageable);
      }
      

        Attachments

          Activity

            People

            Assignee:
            olivergierke Oliver Drotbohm
            Reporter:
            Opal Maciek Opała
            Last updater:
            Oliver Drotbohm
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: