为什么服务器会删除通过 Java Persistence API 创建的数据库内容以及如何防止它?

Why did the server remove database content created through Java Persistence API and how to prevent it?

我是 Java EE 的新手,今天我第一次使用 JPA。 我创建了一个 Java 网络应用程序,并使用本教程将其部署到 Wildfly 服务器上的 Openshift 云: https://blog.openshift.com/build-and-deploy-cloud-aware-java-ee-6-postgresql-92-applications-inside-eclipse/

当我在应用程序中更改某些内容并关闭服务器时,我不知道为什么服务器删除了所有插入的数据。如何预防?我想永久插入数据,而不仅仅是一个服务器会话。

我使用这个函数在数据库中插入数据:

public Foo insertFooToDatabase(Foo foo) {
            entityManager.persist(foo);
            return foo;
}

这是因为 hibernate.hbm2ddl.auto 在 persistence.xml 中设置为 create。有关详细信息,请参阅 Hibernate hbm2ddl.auto possible values and what they do?