Add @Query to Entity properties
gjrwebber opened this issue · comments
Graham Webber commented
It would be nice to be able to add the @query annotation above a referenced Collection of @Entities and have it fetched when the Object is loaded from the graph.
Eg
@Entity
//@NodeEntity if using Neo4j annotations.
public class Person {
private String firstName;
private Location myLocation;
//...
@Query("graph.V().has('firstName', @firstName)")
private Set<Person> peopleWithSameName;
@Query(value = "SELECT expand(in('located_at')) FROM (SELECT FROM Location WHERE [latitude,longitude,$spatial] NEAR [@myLocation.latitude,@myLocation.longitude,{\"maxDistance\":0.05f}])", nativeQuery = true)
private Set<Person> peopleNearMe;
// ...
}