从play framework 2.0.8迁移到2.1.0错误无法构建EntityManagerFactory

时间:2015-02-03 08:00:43

标签: java playframework playframework-2.0 migration playframework-2.1

我已经将游戏框架从2.0.8迁移到2.1.0,之前一切都很完美。现在我收到以下错误:

  

play.api.UnexpectedException:意外异常[PersistenceException:[PersistenceUnit:hbllnd]无法构建EntityManagerFactory]       at play.core.ReloadableApplication $$ anonfun $ get $ 1 $$ anonfun $ 1.apply(ApplicationProvider.scala:142)〜[play_2.10.jar:2.1.0]       at play.core.ReloadableApplication $$ anonfun $ get $ 1 $$ anonfun $ 1.apply(ApplicationProvider.scala:106)〜[play_2.10.jar:2.1.0]       在scala.Option.map(Option.scala:145)〜[scala-library.jar:na]       at play.core.ReloadableApplication $$ anonfun $ get $ 1.apply(ApplicationProvider.scala:106)〜[play_2.10.jar:2.1.0]       at play.core.ReloadableApplication $$ anonfun $ get $ 1.apply(ApplicationProvider.scala:104)〜[play_2.10.jar:2.1.0]       在scala.util.Either $ RightProjection.flatMap(Either.scala:523)[scala-library.jar:na]   引起:javax.persistence.PersistenceException:[PersistenceUnit:hbllnd]无法构建EntityManagerFactory       在org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:915)〜[hibernate-entitymanager-4.1.3.Final.jar:4.1.3.Final]       在org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:890)〜[hibernate-entitymanager-4.1.3.Final.jar:4.1.3.Final]       在org.hibernate.ejb.HibernatePersistence.createEntityManagerFactory(HibernatePersistence.java:57)〜[hibernate-entitymanager-4.1.3.Final.jar:4.1.3.Final]       在javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:63)〜[hibernate-jpa-2.0-api.jar:1.0.1.Final]       在javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:47)〜[hibernate-jpa-2.0-api.jar:1.0.1.Final]       在play.db.jpa.JPAPlugin.onStart(JPAPlugin.java:35)〜[play-java-jpa_2.10.jar:2.1.0]   引起:org.hibernate.MappingException:实体映射中的重复列:models.ProgramModule列:_ebean_intercept(应使用insert =" false" update =" false")映射       在org.hibernate.mapping.PersistentClass.checkColumnDuplication(PersistentClass.java:681)〜[hibernate-core-4.1.3.Final.jar:4.1.3.Final]       在org.hibernate.mapping.PersistentClass.checkPropertyColumnDuplication(PersistentClass.java:703)〜[hibernate-core-4.1.3.Final.jar:4.1.3.Final]       在org.hibernate.mapping.PersistentClass.checkColumnDuplication(PersistentClass.java:725)〜[hibernate-core-4.1.3.Final.jar:4.1.3.Final]       在org.hibernate.mapping.PersistentClass.validate(PersistentClass.java:478)〜[hibernate-core-4.1.3.Final.jar:4.1.3.Final]       在org.hibernate.mapping.RootClass.validate(RootClass.java:270)~ [hibernate-core-4.1.3.Final.jar:4.1.3.Final]       在org.hibernate.cfg.Configuration.validate(Configuration.java:1294)〜[hibernate-core-4.1.3.Final.jar:4.1.3.Final]

这是我的persistence.xml

<?xml version="1.0" encoding="UTF-8"?>
 <persistence version="2.0"
   xmlns="http://java.sun.com/xml/ns/persistence"          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd">
 <persistence-unit name="hbllnd" transaction-type="RESOURCE_LOCAL"  >
    <provider>org.hibernate.ejb.HibernatePersistence</provider>
    <non-jta-data-source>hbllndDS</non-jta-data-source>
    <mapping-file>META-INF/orm.xml</mapping-file>
        <class>models.User</class>
    <properties>
        <property name="hibernate.dialect" value="org.hibernate.dialect.MySQL5Dialect" />
        <property name="hibernate.show_sql" value="true" />
        <property name="hibernate.ejb.use_class_enhancer" value="true" />
    </properties>
</persistence-unit>
</persistence>

这是我的application.conf

# This is the main configuration file for the application.
# ~~~~~

# Secret key
# ~~~~~
# The secret key is used to secure cryptographics functions.
 # If you deploy your application to several instances be sure to use the     same key!
application.secret="dAktNi/d>QGan4fFMnaecK;Bspp;DHQ/F5uU?    VM8<wUVpSJ0`;m]efM2E^^bsaFl"

# The application languages
# ~~~~~
application.langs="en"

# Global object class
# ~~~~~
# Define the Global object class for this application.
# Default to Global in the root package.
# global=Global

# 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="mysql://localhost:3306/test"
#db.default.driver=com.mysql.jdbc.Driver
#db.default.user=""
#db.default.password=""

## HBL L&D
db.hbllnd.url="jdbc:mysql://localhost:3306/hbllnd"
db.hbllnd.driver=com.mysql.jdbc.Driver
db.hbllnd.user="root"
db.hbllnd.pass="root"
db.hbllnd.jndiName=hbllndDS

jpa.hbllnd=hbllnd

# Evolutions
# ~~~~~
# You can disable evolutions if needed
# evolutionplugin=disabled

# Logger
# ~~~~~
# You can also configure logback (http://logback.qos.ch/), by providing a     logger.xml file in the conf directory .

# Root logger:
logger.root=ERROR

# Logger used by the framework:
logger.play=INFO

release.date=20141226
release.version="1.0.1"

# deployment version configuration
include "version.conf"

session.timeout=5
program.expire.days=30

# Logger provided to your application:
logger.application=DEBUG

blog.testMode = true

# SMTP configuration
include "smtp.conf"

# play-easymail configuration
include "play-easymail.conf"

任何人都可以告诉我这个问题是什么?

编辑:通过禁用jBean来解决它。

1 个答案:

答案 0 :(得分:1)

通过禁用jBean来解决它。