I just started using QueryDSL and ran into a problem. Is it possible to do orderBy using column name? I found this to generate a dynamic orderBy path:
General querydsl query. Dynamic path generation with left joins
which is great, but in my case the GUI is already sending column names for ordering. For example, "USER_ID" is the name of the column, and the property is "userid"
@Entity
@Table(name="USER")
public class User implements java.io.Serializable {
private String userid;
@Id
@Column(name="USER_ID", unique=true, nullable=false, length=18)
public String getUserid() {
return this.userid;
}
}
Extracting a property name from a column name in hibernate is the only solution I can think of.
I would be grateful for any suggestions.
source
share