Uploaded image for project: 'DeltaSpike'
  1. DeltaSpike
  2. DELTASPIKE-1447

EntityRepository does not support OrderBy for Nested Properties

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 1.9.5
    • None
    • Data-Module
    • Security Level: public (Regular issues)

    Description

      The orderBy query referencing a nested property of an embedded type does not work.

       

      @Entity(name = "foo")
      public class FooEntity {
          @Id @GeneratedValue
          private UUID id;
      
          @Embedded
          private final MyEmbedded myEmbedded = new MyEmbedded();
      }

       

      @Embeddable
      public static class MyEmbedded implements Serializable {
      
          private static final long serialVersionUID = 4295282492309712345L;
      
          @NotNull
          @Column(name = "created", nullable = false)
          private LocalDateTime createdOn;
      
          @PrePersist
          void prePersist() {
              createdOn = ZonedDateTime.now().toInstant().atZone(ZoneId.of("UTC")).toLocalDateTime();
          }
      }

       

      @Repository(forEntity = FooEntity.class)
      public interface FooRepository extends EntityRepository<FooEntity, UUID> {
      
          List<FooEntity> findAllOrderByMyEmbedded_CreatedOnDesc();
      }

      The created query seems to be correct:

      select * from foo order by created desc

      Error:

      org.apache.deltaspike.data.api.QueryInvocationException: Failed calling Repository: [
      Repository=my.company.FooRepository,
      entity=my.company.FooEntity,method=findAllOrderByMyEmbedded_CreatedOnDesc,
      exception=class org.apache.deltaspike.data.api.QueryInvocationException,
      message=Failed calling Repository: [
      Repository=my.company.FooRepository,
      entity=my.company.FooEntity,
      method=findAllOrderByMyEmbedded_CreatedOnDesc, 

      It get's stuck at: org.apache.deltaspike.data.impl.builder.DelegateQueryBuilder#execute, returning NULL for the DelegateQueryHandler.

       

       

      Attachments

        Activity

          People

            Unassigned Unassigned
            svenhaag Sven Haag
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: