On 21 déc. 2011, at 16:29, Sanne Grinovero wrote: > <nicolas.hellerin...@gmail.com> wrote: >> My two cents : >> >> - .onLocation("position") >> >> - .onLatitude("lat").onLongitude("lng") > > I'm confused on what the String represents. I'm going to assume index > fields? So I'm preferring the "onLocation*Field* [..]" versions. > > Moreover, assuming we have some @Spatial annotation on the entity, > can't we figure out the fields automatically, or at least have to > point only the the property getter of component object which provides > both latitude and longitude?
That's a good point but we need to support the case where more than one field is annotated @Spatial so they have to have a virtual name. This is the role of onCoordinates(...). I imagine we will need to put this name on @Spatial(property="location") where property defaults to the property name and is mandatory when placed on a entity class (type annotation). The case for onLatitudeField / onLongitudeField is for people that do not want to implement nor use the `Coordinate` type in their model and use two free properties. Maybe `Coordinates` is a bad idea entirely and we should only use "free form properties" like this ``` @Indexed @Spatial(latitudeProperty="latitude", longitudeProperty="longitude", strategy=GRID) public class Address { public double getLatitude() { ... } public double getLongitude() { ... } } ``` Remember the alternative forms are using `Coordinates`, a Hibernate Search type ``` @Indexed @Spatial(property="location", strategy=GRID) public class Address implements Coordinates { public double getLatitude() { ... } public double getLongitude() { ... } } ``` ``` @Indexed public class Address implements Coordinates { @Spatial(strategy=GRID) public Coordinates getLocation() { new Coordinates() { public double getLatitude() { ... } public double getLongitude() { ... } } } ``` By the way, I think a better name for .onCoordinates / forCoordinates is simply onProperty(String). WDTY? _______________________________________________ hibernate-dev mailing list hibernate-dev@lists.jboss.org https://lists.jboss.org/mailman/listinfo/hibernate-dev