Creating multiple aliases for the same QueryDSL path in Spring Data

You can create a transient property bound to QueryDSL this way:

@Transient
@QueryType(PropertyType.SIMPLE)
public String getNameEndsWith() {
    // Whatever code, even return null
}

If you are using the QueryDSL annotation processor, you will see the “nameEndsWith” in the metadata Qxxx class, so you can bind it like any persisted property, but without persisting it.

Leave a Comment