我正在用@ElementCollection 测试@OrderBy,但它似乎不起作用。我检索拥有元素集合的实体并打印集合,它没有对任何东西进行排序..
@Entity
public class AtAsOverride
@ElementCollection(fetch = FetchType.LAZY)
@Column(name = "Strings")
@OrderBy(value="stringuri desc") // tried everything: without any value, strings, stringuri ..
private List<String> stringuri;
Query qq = em.createQuery("Select a from AtAsOverride a");
System.out.println(AtAsOverride.class.cast(qq.getResultList().get(0)).getStringuri());