如何避免使用PlayFramework创建架构 [英] How to avoid creating schema with PlayFramework
问题描述
我有一个由另一个Web应用程序管理的现有数据库架构.我正在创建的播放框架需要读取/写入此现有模式,但是在播放开始时它将删除并重新创建表.
I have an existing database schema managed by another webapp. The playframework I am creating needs to read/write to this existing schema but it's deleting and recreating the tables when play starts up.
如何关闭表创建?
更新:
- 播放1.2.5
- mysql
update2:
@Entity(name="mytable_name")
public class Sample extends Model {
public Integer some_value;
public String fullname;
}
在Controller方法内部...
inside a Controller method...
List<Sample> list = Sample.findAll();
该表存在数据,我运行播放测试",点击调用findAll的控制器方法,然后该表被删除,重新创建,现在为空.
The table exists with data, I run "play test", hit the controller method that calls findAll, and the table is dropped, recreated, and now empty.
在文本字段大小不同的数据类型中,模式并不完全匹配.我期待查询错误,但不是.
The schemas do not match perfectly in data types with text fields being different sizes. I was expecting query errors but not this.
推荐答案
如果您将Play 1.x与JPA一起使用,则可以将此行放入application.conf
If you are using Play 1.x with JPA you can put this line in your application.conf
jpa.ddl=none
这篇关于如何避免使用PlayFramework创建架构的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!