0

I am new in Java EE and today I used JPA for the first time. I created a Java web app and deployed it to Openshift cloud on a Wildfly server using this tutorial: https://blog.openshift.com/build-and-deploy-cloud-aware-java-ee-6-postgresql-92-applications-inside-eclipse/

I have no idea why the server removed all inserted data, when I changed something in the app and turned off the server. How to prevent it? I want to insert data permanently, not for only one server session.

I used this function to insert data in the database:

public Foo insertFooToDatabase(Foo foo) {
            entityManager.persist(foo);
            return foo;
}
tux3
  • 7,171
  • 6
  • 39
  • 51
foo
  • 37
  • 5

1 Answers1

1

This is because hibernate.hbm2ddl.autoin persistence.xml is set to create. For more information see Hibernate hbm2ddl.auto possible values and what they do?

Community
  • 1
  • 1
MirMasej
  • 1,592
  • 12
  • 17