Grails Association Duplicate Error Criteria
I am trying to use aliases along with normal association names in a criterion which gives me a "duplicate association path error", my classes look like this
class FlightReservation{
Flight flight
User usr
String title
}
class Flight {
String flightNumber
Category category
}
class Category {
String name
}
Request criteria
FlightReservation.createCriteria().list(){
createAlias("flight", "flt", CriteriaSpecification.LEFT_JOIN)
flight{
location{
eq("name", "abc")
}
}
order("flt.flightNumber", "asc")
}
Now that I think about it, it seems obvious and maybe a limitation of Hibernate so I want to know if there is an alternative approach to achieve this
I know I can use fetchMode to load the aviation association but excluding the alias from the request will make it harder for the order proposal (which will be dynamic, and closing the closure will make things ugly)
Can you tell me why I can't use "flt" (alias) in both places? Actually this other criterion, which uses a nested closure instead of an alias, comes from some other part of the code, and I have to reuse that code.
Let me know if the question is not clear enough, any details on this error would be really helpful.
source to share
No one has answered this question yet
See similar questions:
or similar: