如何在apache deltaspike中的嵌入类字段上使用Order By子句

时间:2017-04-14 07:26:48

标签: deltaspike

我试图在updatedOn字段的基础上对员工类的记录进行排序。 UpdatedOn字段位于ChangeInfo类中,它是员工类的嵌入类。我是用apache deltaspike做的。

示例:

标准crtieria = findEmployees(); criteria.join(Employee_.changeInfo,其中(ChangeInfo.class).orderDesc(ChangeInfo_.updatedOn));

当我使用上面的代码时,我不会在最终查询中附加一个order by子句。

 @Entity
 @Table(name = "employee")
 public class Employee 
 {
    @Id
  @Column(name = "id", unique = true, nullable = false, precision = 9)
   private Long id ;
   @Column(name = "name")
   private String name;
   @Column(name = "designation")
   private String designation;
   @Embedded
   private ChangeInfo changeInfo;

}


public class ChangeInfo {

  @Temporal(TemporalType.TIMESTAMP)
  @Column(name = "updated_on")
  private Date updatedOn;

  @Column(name = "updatedBy")
  private String updatedBy;
}

0 个答案:

没有答案