【发布时间】:2013-07-12 07:32:10
【问题描述】:
您好,我在尝试保存模型对象时遇到上述错误。以下是我的 Application.conf 文件的相关部分:
# Database configuration
# ~~~~~
# You can declare as many datasources as you want.
# By convention, the default datasource is named `default`
#
db.default.driver=org.h2.Driver
db.default.url="jdbc:h2:mem:play"
db.default.user=sa
db.default.password=""
# Ebean configuration
# ~~~~~
# You can declare as many Ebean servers as you want.
# By convention, the default server is named `default`
#
ebean.default="models.*"
# ebean.datasource.default=DefaultDS
我自己添加了最后一行,但出于此目的将其注释掉,因为我不知道它是否正确。
我知道this 的答案,但我没有找到特别清楚的答案(我是在使用JNDI,如果我要覆盖前缀,我要覆盖它什么?)
任何帮助或指示都会很棒。我在 Ubuntu 上。
【问题讨论】:
-
你得到什么样的错误?你的模型看起来怎么样?
-
在 play framework 2.0.x 通常默认 DB 配置为这个 db.default.jndiName=DefaultDS 但是你可以配置不同的数据源,查看这个链接了解更多信息:avaje.org/configure_editproperties.html
-
您是在测试中还是在 src 中运行 save() 方法?我刚才遇到了同样的错误,因为我在数据库初始化之前调用了 save()。
标签: java playframework playframework-2.0 ebean