Open
Description
Currently it is only possible to include the target type within an interface projection when operating upon associations. It should be allowed to use interface projections on references using @DBRef
.
public class WithRefs { // source domain type
@Id String id;
@DBRef Planet planet;
}
public interface ProjectPlanetUsingOriginalTargetType {
Planet getPlanet();
}
template.query(WithRefs.class).as(ProjectPlanetUsingOriginalTargetType.class) // works
public interface ProjectPlanetUsingInterfaceProjection {
PlanetProjection getPlanet(); // fails
}
public interface PlanetProjection {
String getName();
}
template.query(WithRefs.class).as(ProjectPlanetUsingInterfaceProjection.class) // fails
Related Issue: #3894