如何使用不同名称的JPA Config而不是“默认”?

时间:2014-09-10 14:52:45

标签: playframework-2.0 playframework-2.2

我已经在我的application.conf中设置了一个名为“staging”的配置:

jpa.staging=oraclePersistenceUnitStaging
db.staging.driver=oracle.jdbc.OracleDriver
db.staging.url="jdbc:oracle:thin:@localhost:1521:XE"
db.staging.user=udrtnsm
db.staging.password="kldj90fdkl"
db.staging.jndiName=OracleDSStaging

Evolutions设置连接并应用脚本,但应用程序的第一个请求显示:

play.api.Application$$anon$1: Execution exception[[RuntimeException: No JPA     EntityManagerFactory configured for name [default]]]
at play.api.Application$class.handleError(Application.scala:293) ~[play_2.10.jar:2.2-SNAPSHOT]
at play.api.DefaultApplication.handleError(Application.scala:399) [play_2.10.jar:2.2-SNAPSHOT]
at play.core.server.netty.PlayDefaultUpstreamHandler$$anonfun$2$$anonfun$applyOrElse$3.apply(PlayDefaultUpstreamHandler.scala:261) [play_2.10.jar:2.2-SNAPSHOT]
at play.core.server.netty.PlayDefaultUpstreamHandler$$anonfun$2$$anonfun$applyOrElse$3.apply(PlayDefaultUpstreamHandler.scala:261) [play_2.10.jar:2.2-SNAPSHOT]
at scala.Option.map(Option.scala:145) [scala-library-2.10.3.jar:na]
at   play.core.server.netty.PlayDefaultUpstreamHandler$$anonfun$2.applyOrElse(PlayDefaultUpstreamHandler.scala:261) [play_2.10.jar:2.2-SNAPSHOT]
Caused by: java.lang.RuntimeException: No JPA EntityManagerFactory configured for name [default]
at play.db.jpa.JPA.em(JPA.java:34) ~[play-java-jpa_2.10.jar:2.2.1]
at play.db.jpa.JPA.withTransactionAsync(JPA.java:169) ~[play-java-jpa_2.10.jar:2.2.1]
at play.db.jpa.TransactionalAction.call(TransactionalAction.java:15) ~[play-java-jpa_2.10.jar:2.2.1]
at play.core.j.JavaAction$$anon$3.apply(JavaAction.scala:91) ~[play_2.10.jar:2.2-SNAPSHOT]
at play.core.j.JavaAction$$anon$3.apply(JavaAction.scala:90) ~[play_2.10.jar:2.2-SNAPSHOT]
at play.core.j.FPromiseHelper$$anonfun$flatMap$1.apply(FPromiseHelper.scala:82) ~[play_2.10.jar:2.2-SNAPSHOT]

为什么还要尝试连接“默认”? 即使我的conf文件中没有默认值? 即使它正在寻找与数据源的连接以应用演化吗?

0 个答案:

没有答案