I had a ActiveJDBC model called Job
, and defined some static attributes like title
, salary
, workplace
and so on.
public class Job extends Model {
public String getTitle() {
return getString("title");
}
public void setTitle(String title) {
setString("title", title);
}
public Integer getSalary() {
return getInteger("salary");
}
public void setSalary(Integer salary) {
setInteger("salary", salary);
}
public String getWorkplace() {
return getString("workplace");
}
public void setWorkplace(String workplace) {
setString("workplace", workplace);
}
}
Now I want to find jobs based on geometry distance by below sql:
String sql = "select *, ST_distance(...) as distance from jobs... order by distance asc";
LazyList<Job> jobs = Job.findBySql(sql);
How can I read the virtual attribute distance
from Job
model?
I have tried to add distance
column in jobs
table, and it reported error ERROR: ORDER BY "distance" is ambiguous