Uploaded image for project: 'JBoss Enterprise Application Platform'
  1. JBoss Enterprise Application Platform
  2. JBEAP-26357

[GSS](8.0.z) HHH-17623 - Ordering collection @OrderBy based on association fails

XMLWordPrintable

      An entity model that orders a collection by an association of the element fails with an UnsupportedOperationException.

       @Entity(name = "Task")
       public static class Task {
      
         @Id
         private Long id;
         @OneToMany(mappedBy = "task")
         @OrderBy("assignee ASC")
         private List<TaskVersion> taskVersions;
       }
      
       @Entity(name = "TaskVersion")
       public static class TaskVersion {
         @Id
         private Long id;
      
         @ManyToOne(fetch = FetchType.EAGER)
         @JoinColumn(name = "assignee", nullable = true)
         private User assignee;
      
         @ManyToOne(fetch = FetchType.EAGER)
         @JoinColumn(name = "task_id", nullable = false)
         private Task task;
         private String name;
       }
      
       @Entity(name = "UUser")
       public static class User {
         @Id
         private Long id;   
         private String name;
       } 

              rhn-support-ivassile Ilia Vassilev
              rhn-support-bmaxwell Brad Maxwell
              Votes:
              0 Vote for this issue
              Watchers:
              11 Start watching this issue

                Created:
                Updated:
                Resolved: