I have a table Restaurants
which stores the details of restaurants including Latitude
and Longitude
.now i have to sort out the records from DB those within 20 Kilo Meter
of the given Lat/Lon
input values.
I am using RESTful web-service with hibernate.
Entity Class
@Entity
@Table(name = "restaurants")
public class Restaurants implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "restaurant_id")
private int restaurantId;
@Column(name = "restaurant_name")
private String restaurantName;
@Column(name = "category_id")
private Integer categoryId;
@Column(name = "image_url")
private String imageUrl;
private Float longitude;
private Float latitude;
@Column(name = "contact_name")
private String contactName;
@Column(name = "primary_phone")
private String primaryPhone;
@Column(name = "secondary_phone")
private String secondaryPhone;
private String fax;
private String address1;
private String address2;
//Getters and Setters
}
I have surfed but couldn't find any satisfying answer.is it preferable between
operation to find out the difference between Lat/Long
.or do i use Criteria
? Any one please provide me an answer .?