We have an old application where the relationship is defined as below:
class Practice {
String name
static hasmany = [doctors:Doctor]
}
and
class Doctor {
String name
}
There is not a belongsTo relationship defined in Doctor as we do not want to cascade the delete of a doctor when Practice is deleted. This is a very old code and do not want to change it.
Now according to the new functionality, the user should know which Practices the Doctor is linked to while viewing the details of a Doctor. Can anyone help me knowing which is the easiest way of achieving this without making changes to the domain object?
If variable
doctorcontains the doctor you want to list practices from, you can get a list ofPracticeobjects having this doctor in their doctors relationship by issuing the following criteria query: