MySQL tables are empty after restarting Linux application [closed]












-2















I am using hibernate to persist entity objects in a local running database.



Everything is working fine (connecting to the database, add/delete/update entries), as long as the application is running.



I am using this code to pass the entry to a table:



CrudRepository:



public interface ArticleRepository extends CrudRepository<ArticleEntity, Integer> {
}


DB accessor method:



public void addArticleEntity(ArticleEntity articleEntity){
articleRepository.save(articleEntity);
}


After restarting the application all the entries are gone, only the empty table itself is persisted permanently.



How can I save these table entries permanently?










share|improve this question















closed as off-topic by Mureinik, Madhur Bhaiya, jww, Mike M., Makyen Nov 17 '18 at 5:11


This question appears to be off-topic. The users who voted to close gave this specific reason:


  • "Questions seeking debugging help ("why isn't this code working?") must include the desired behavior, a specific problem or error and the shortest code necessary to reproduce it in the question itself. Questions without a clear problem statement are not useful to other readers. See: How to create a Minimal, Complete, and Verifiable example." – jww, Makyen

If this question can be reworded to fit the rules in the help center, please edit the question.





















    -2















    I am using hibernate to persist entity objects in a local running database.



    Everything is working fine (connecting to the database, add/delete/update entries), as long as the application is running.



    I am using this code to pass the entry to a table:



    CrudRepository:



    public interface ArticleRepository extends CrudRepository<ArticleEntity, Integer> {
    }


    DB accessor method:



    public void addArticleEntity(ArticleEntity articleEntity){
    articleRepository.save(articleEntity);
    }


    After restarting the application all the entries are gone, only the empty table itself is persisted permanently.



    How can I save these table entries permanently?










    share|improve this question















    closed as off-topic by Mureinik, Madhur Bhaiya, jww, Mike M., Makyen Nov 17 '18 at 5:11


    This question appears to be off-topic. The users who voted to close gave this specific reason:


    • "Questions seeking debugging help ("why isn't this code working?") must include the desired behavior, a specific problem or error and the shortest code necessary to reproduce it in the question itself. Questions without a clear problem statement are not useful to other readers. See: How to create a Minimal, Complete, and Verifiable example." – jww, Makyen

    If this question can be reworded to fit the rules in the help center, please edit the question.



















      -2












      -2








      -2








      I am using hibernate to persist entity objects in a local running database.



      Everything is working fine (connecting to the database, add/delete/update entries), as long as the application is running.



      I am using this code to pass the entry to a table:



      CrudRepository:



      public interface ArticleRepository extends CrudRepository<ArticleEntity, Integer> {
      }


      DB accessor method:



      public void addArticleEntity(ArticleEntity articleEntity){
      articleRepository.save(articleEntity);
      }


      After restarting the application all the entries are gone, only the empty table itself is persisted permanently.



      How can I save these table entries permanently?










      share|improve this question
















      I am using hibernate to persist entity objects in a local running database.



      Everything is working fine (connecting to the database, add/delete/update entries), as long as the application is running.



      I am using this code to pass the entry to a table:



      CrudRepository:



      public interface ArticleRepository extends CrudRepository<ArticleEntity, Integer> {
      }


      DB accessor method:



      public void addArticleEntity(ArticleEntity articleEntity){
      articleRepository.save(articleEntity);
      }


      After restarting the application all the entries are gone, only the empty table itself is persisted permanently.



      How can I save these table entries permanently?







      java mysql linux persist






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Nov 17 '18 at 3:49









      jww

      54.1k41234513




      54.1k41234513










      asked Nov 16 '18 at 12:02









      elpelp

      364116




      364116




      closed as off-topic by Mureinik, Madhur Bhaiya, jww, Mike M., Makyen Nov 17 '18 at 5:11


      This question appears to be off-topic. The users who voted to close gave this specific reason:


      • "Questions seeking debugging help ("why isn't this code working?") must include the desired behavior, a specific problem or error and the shortest code necessary to reproduce it in the question itself. Questions without a clear problem statement are not useful to other readers. See: How to create a Minimal, Complete, and Verifiable example." – jww, Makyen

      If this question can be reworded to fit the rules in the help center, please edit the question.







      closed as off-topic by Mureinik, Madhur Bhaiya, jww, Mike M., Makyen Nov 17 '18 at 5:11


      This question appears to be off-topic. The users who voted to close gave this specific reason:


      • "Questions seeking debugging help ("why isn't this code working?") must include the desired behavior, a specific problem or error and the shortest code necessary to reproduce it in the question itself. Questions without a clear problem statement are not useful to other readers. See: How to create a Minimal, Complete, and Verifiable example." – jww, Makyen

      If this question can be reworded to fit the rules in the help center, please edit the question.
























          2 Answers
          2






          active

          oldest

          votes


















          0














          The persist method is intended for adding a new entity instance to the persistence context, i.e. transitioning an instance from transient to persistent state.



          We usually call it when we want to add a record to the database (persist an entity instance):



          Person person = new Person();
          person.setName("John");
          session.persist(person);


          For more information:
          https://www.baeldung.com/hibernate-save-persist-update-merge-saveorupdate






          share|improve this answer































            0














            Sorry for posting such random information, I simply had no idea where to start searching. Even tho, downvoting did not help.



            The solution was to set spring.jpa.hibernate.ddl-auto=create (which obviously create new tables on restart) to spring.jpa.hibernate.ddl-auto=update.



            Probably it'll help someone looking for similar terms.






            share|improve this answer






























              2 Answers
              2






              active

              oldest

              votes








              2 Answers
              2






              active

              oldest

              votes









              active

              oldest

              votes






              active

              oldest

              votes









              0














              The persist method is intended for adding a new entity instance to the persistence context, i.e. transitioning an instance from transient to persistent state.



              We usually call it when we want to add a record to the database (persist an entity instance):



              Person person = new Person();
              person.setName("John");
              session.persist(person);


              For more information:
              https://www.baeldung.com/hibernate-save-persist-update-merge-saveorupdate






              share|improve this answer




























                0














                The persist method is intended for adding a new entity instance to the persistence context, i.e. transitioning an instance from transient to persistent state.



                We usually call it when we want to add a record to the database (persist an entity instance):



                Person person = new Person();
                person.setName("John");
                session.persist(person);


                For more information:
                https://www.baeldung.com/hibernate-save-persist-update-merge-saveorupdate






                share|improve this answer


























                  0












                  0








                  0







                  The persist method is intended for adding a new entity instance to the persistence context, i.e. transitioning an instance from transient to persistent state.



                  We usually call it when we want to add a record to the database (persist an entity instance):



                  Person person = new Person();
                  person.setName("John");
                  session.persist(person);


                  For more information:
                  https://www.baeldung.com/hibernate-save-persist-update-merge-saveorupdate






                  share|improve this answer













                  The persist method is intended for adding a new entity instance to the persistence context, i.e. transitioning an instance from transient to persistent state.



                  We usually call it when we want to add a record to the database (persist an entity instance):



                  Person person = new Person();
                  person.setName("John");
                  session.persist(person);


                  For more information:
                  https://www.baeldung.com/hibernate-save-persist-update-merge-saveorupdate







                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered Nov 16 '18 at 12:10









                  AbhishekAbhishek

                  396117




                  396117

























                      0














                      Sorry for posting such random information, I simply had no idea where to start searching. Even tho, downvoting did not help.



                      The solution was to set spring.jpa.hibernate.ddl-auto=create (which obviously create new tables on restart) to spring.jpa.hibernate.ddl-auto=update.



                      Probably it'll help someone looking for similar terms.






                      share|improve this answer




























                        0














                        Sorry for posting such random information, I simply had no idea where to start searching. Even tho, downvoting did not help.



                        The solution was to set spring.jpa.hibernate.ddl-auto=create (which obviously create new tables on restart) to spring.jpa.hibernate.ddl-auto=update.



                        Probably it'll help someone looking for similar terms.






                        share|improve this answer


























                          0












                          0








                          0







                          Sorry for posting such random information, I simply had no idea where to start searching. Even tho, downvoting did not help.



                          The solution was to set spring.jpa.hibernate.ddl-auto=create (which obviously create new tables on restart) to spring.jpa.hibernate.ddl-auto=update.



                          Probably it'll help someone looking for similar terms.






                          share|improve this answer













                          Sorry for posting such random information, I simply had no idea where to start searching. Even tho, downvoting did not help.



                          The solution was to set spring.jpa.hibernate.ddl-auto=create (which obviously create new tables on restart) to spring.jpa.hibernate.ddl-auto=update.



                          Probably it'll help someone looking for similar terms.







                          share|improve this answer












                          share|improve this answer



                          share|improve this answer










                          answered Nov 16 '18 at 12:32









                          elpelp

                          364116




                          364116















                              Popular posts from this blog

                              Xamarin.iOS Cant Deploy on Iphone

                              Glorious Revolution

                              Dulmage-Mendelsohn matrix decomposition in Python