2016-08-15 113 views
1

我正在嘗試集成Play Authenticate,同時仍在應用程序的其他任何位置使用JPA。在同一個Play Framework項目中同時使用Ebean和JPA

我:

ProvisionException: Unable to provision, see the following errors: 

1) Error injecting constructor, java.lang.NoSuchMethodError: javax.persistence.OneToMany.orphanRemoval()Z 
    at play.db.jpa.DefaultJPAApi$JPAApiProvider.<init>(DefaultJPAApi.java:39) 
    at play.db.jpa.DefaultJPAApi$JPAApiProvider.class(DefaultJPAApi.java:34) 
    while locating play.db.jpa.DefaultJPAApi$JPAApiProvider 
    while locating play.db.jpa.JPAApi 
    for parameter 2 at controllers.Persons.<init>(Persons.java:33) 
    while locating controllers.Persons 
    for parameter 5 at router.Routes.<init>(Routes.scala:48) 
    while locating router.Routes 
    while locating play.api.inject.RoutesProvider 
    while locating play.api.routing.Router 
    for parameter 0 at play.api.http.JavaCompatibleHttpRequestHandler.<init>(HttpRequestHandler.scala:200) 
    while locating play.api.http.JavaCompatibleHttpRequestHandler 
    while locating play.api.http.HttpRequestHandler 
    for parameter 4 at play.api.DefaultApplication.<init>(Application.scala:221) 
    at play.api.DefaultApplication.class(Application.scala:221) 
    while locating play.api.DefaultApplication 
    while locating play.api.Application 

1 error 

加入這行來build.sbt和plugins.sbt前:

excludeDependencies += "javax.persistence" % "persistence-api" 
然而

,我需要爲我的模型作爲

[NullPointerException: null] 

由@Entity註釋觸發。

我剛剛開始使用這個Play框架的Java,所以可能會出現我錯過的東西。如有必要,請指出。

+0

您在類路徑(JPA 1?)中擁有JPA API jar的一個版本,並且您需要JPA API v2 +。因此,Play或EBean會對您施加一些依賴關係,以及您可以使用哪個JPA提供程序 –

回答

2

有這個thread哪裏有人要求在項目中實施Hibernate。

This is his implementation

看一看這些鏈接,它可能會幫助,因爲你不必使用Ebean可言。

相關問題