Hi Emmanuel, hi all, I am not fond of Coordinates interface too :s
I think we shall stick to Option 1 as it concentrates configuration information in one place and we can stick to default values for field names for ease of use. People that do have a latitude property on their beans often named it ... latitude, don't they ? Niko 2012/2/10 Emmanuel Bernard <emman...@hibernate.org> > Nicolas, > > I'm geting a bit cold feet on our initial implementation. We have decided > to use Coordinates as the placeholder of lat and long. Coordinates is an > Hibernate Search interface. Reading the draft of your doc and as an app > developer, I don't find it too attractive to have to use this interface in > my domain model. > I'm wondering if we should rather do as Karel suggested: support the "free > form" and wait for Hibernate Spatial types to introduce such a concept. > > That means we need to find a way to tag the lat / long getters > > ## Option 1 > > ``` > @Spatial( > field="coordinates", > latitude="latitude", //property name > longitude="longitude", > method=QUAD > ) > public class Restaurant { > public double getLatitude() { ... } > public double getLongitude() { ... } > } > ``` > > ### Embedded objects > > ``` > @Spatial( > field="coordinates", > latitude="place.latitude", //property name > longitude="place.longitude", > method=QUAD > ) > public class Restaurant { > public Place getPlace {} { ... } > > } > > //user defined > public class Place { > public double getLatitude() { ... } > public double getLongitude() { ... } > } > ``` > > ``` > public class Restaurant { > @Spatial( > field="coordinates", > latitude="latitude", //property name > longitude="longitude", > method=QUAD > ) > public Place getPlace {} { ... } > > } > > //user defined > public class Place { > public double getLatitude() { ... } > public double getLongitude() { ... } > } > ``` > > > ## Option 2 > > ``` > @Spatial( > field="coordinates", > method=QUAD > ) > public class Restaurant { > @Latitude(for="coordinates") > public double getLatitude() { ... } > > @Longitude(for="coordinates") > public double getLongitude() { ... } > } > ``` > > ### Embedded objects > > ``` > @Spatial( > field="coordinates", > method=QUAD > ) > public class Restaurant { > public Place getPlace {} { ... } > > } > > //user defined > public class Place { > @Latitude(for="coordinates") > public double getLatitude() { ... } > @Longitude(for="coordinates") > public double getLongitude() { ... } > } > ``` > > ## Opinion > > I am not thrilled by what I am proposing, esp since they involve String as > the link in our metadata. If someone has something better, go ahead. > Otherwise, I think I like option 1 better for a few reasons: > > - easier to implement > - easier to read > - supports nicely embedded objects > - does not force the embedded object to be annotated (limit of reuse?)\\ > > what do you all think? > _______________________________________________ > hibernate-dev mailing list > hibernate-dev@lists.jboss.org > https://lists.jboss.org/mailman/listinfo/hibernate-dev > _______________________________________________ hibernate-dev mailing list hibernate-dev@lists.jboss.org https://lists.jboss.org/mailman/listinfo/hibernate-dev