Hi
My config:
* hibernate-3.3.1.GA
* hibernate-annotations-3.3.1.GA
* hibernate-entitymanager-3.4.0.GA
Whether @OrderBy should be taken into account when using filtered collections?
I can see that ordering defined by @OrderBy is
not used in SELECT generated by filtered collections mechanism.
My mapping looks like this:
Code:
@Entity
@Table(name="MOTHER")
public class Mother
{
private List<Child> child;
@OneToMany(fetch=FetchType.LAZY, mappedBy="mother")
@org.hibernate.annotations.OrderBy(clause="seqno desc")
public List<Child> getChild()
{
return child;
}
Code:
@Entity
@Table(name="CHILD")
public class Child
{
Mother mother;
@ManyToOne(fetch=FetchType.LAZY)
public Mother getMother ()
{
return mother;
}
And an example of piece of code using createFilter mechanism:
Code:
final List<Child> list =
session
.createFilter(mother.getChild(), "where status is not null")
.setMaxResults(1)
.list();
And there is no ORDER BY is SQL generated by Hibernate.
Is it OK?
Regards,
Adam