0
我在Play 2.1.5中有項目,並且我決定遷移到Play 2.2.1。我跟着http://www.playframework.com/documentation/2.2.1/Migration22和一切工作,除了在啓動時,它看起來像項目試圖創建數據庫,而不是更新它。我總是得到重複錯誤。我在使用Play 2.1.5時沒有遇到這個問題。我看不出有什麼問題,我的配置,但也許我忽略的東西:Play framework 2.2.1總是試圖在啓動時創建數據庫
application.conf:
db.default.jndiName=DefaultDS
jpa.default=defaultPersistenceUnit
db.default.url="jdbc:mysql://localhost/database"
db.default.driver=com.mysql.jdbc.Driver
的persistence.xml:
<persistence 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"
version="2.0">
<persistence-unit name="defaultPersistenceUnit" transaction-type="RESOURCE_LOCAL">
<provider>org.hibernate.ejb.HibernatePersistence</provider>
<non-jta-data-source>DefaultDS</non-jta-data-source>
<properties>
<property name="hibernate.dialect" value="org.hibernate.dialect.MySQLDialect"/>
<property name="hibernate.format_sql" value="true"/>
<property name="hibernate.hbm2ddl.auto" value="update"/>
</properties>
</persistence-unit>
Build.scala依賴包含:
javaCore,
javaJdbc,
javaJpa,
cache,
"org.hibernate" % "hibernate-entitymanager" % "4.2.7.Final"
當你運行該項目時,你可以在控制檯上看到任何'create/drop' sql? – Amogh
你的數據庫中有play_evolutions表嗎? – Peter
沒有play_evolutions表。而當我運行應用程序控制臺給我只有像這樣的錯誤:** com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException:加載配置後,重複'COLUMN_NAME'鍵**的條目'VALUE'。應用程序本身運行,但啓動時出現這些錯誤是不可接受的 – user2545521