我有一个尝试部署到 Heroku 的 Play 2.0 应用程序。成功编译并在 localhost 上运行后,Heroku 抱怨type "double" does not exist。该应用程序本身与位于此处的 JavaTodoList 教程极为相似:
http://www.playframework.com/documentation/2.0/JavaTodoList
除了模型有 Double 字段,而不是 String 字段,如下所示:
package models;
import java.util.List;
import javax.persistence.Entity;
import javax.persistence.Id;
import play.data.validation.Constraints.Required;
import play.db.ebean.Model;
@SuppressWarnings("serial")
@Entity
public class GeoPoint extends Model {
@Id
public Long id;
@Required
public Double latitude;
@Required
public Double longitude;
@SuppressWarnings({ "rawtypes", "unchecked" })
public static Finder<Long, GeoPoint> find = new Finder(Long.class, GeoPoint.class);
public static List<GeoPoint> all() {
return find.all();
}
public static void create(GeoPoint task) {
task.save();
}
public static void delete(Long id) {
find.ref(id).delete();
}
}
我相信这与 PostgreSQL 驱动程序生成 SQL 类型为double而不是double precision的列有关。