Hi,
Recentrly I needed to retrieve data from DB sorted by Discriminator Column and I'm stuck.
Problem is, I haven't found any solution how to to this using AuditQuery.
In simple HQL I could use (...) order by Entity.class, but how to do such thing in AQ?
Here is the sample code of my entity class
@Audited
@Entity
@Table(name = "something")
@Inheritance(strategy=InheritanceType.SINGLE_TABLE)
@DiscriminatorColumn(
name="something_type",
discriminatorType=DiscriminatorType.STRING
)
@DiscriminatorValue(Something.ENTITY_TYPE)
public class Entity extends Something {
(......)
}
I would be grateful for help
SOLUTION
Finally I found the solution. Looks like all you need to do is add order by "class", example
query.addOrder(AuditEntity.property("class").asc())