0

I am using play framework 2.4 with java to develop a web application and I have included a embedded H2 DB file in the project. This file is included in a separate folder called “db”. I have to use git force add to add this file to git since the content in this folder is ignored by git. The code works fine in my local machine and after I pull from the origin it says already up to date(No difference between my local repo and the repo in the origin). But when someone else clone and run this project it says the table 'SOMENAME' is not found in the database(The database connection is okay). And cannot find any difference between that cloned project and the origin repo as well. But when I copy the project in my local machine to that machine it runs without a problem. I am really confused and what could be the reason for this problem? Both machines use the same play version and same OS.

Supun Wijerathne
  • 11,964
  • 10
  • 61
  • 87
  • the database 'SOMENAME' table of others exists in their database? please be guaranteed that his database is consistent with yours. – Jerry May 13 '16 at 03:58
  • Yes. It exists, when I check theirs. – Supun Wijerathne May 13 '16 at 04:00
  • 1
    so strange, but obviously, it's not the fault of your code, the question may help you http://stackoverflow.com/questions/5763747/h2-in-memory-database-table-not-found – Jerry May 13 '16 at 04:12

1 Answers1

2

I had the same experience. After the play version 1.4, it automatically creates a mv db when you try to connect to a h2 db. Then it reads this empty mv db, instead of your h2 db. That is why it says your table is not found. The reason to not to show any difference between the origin and the cloned repository, is the content in your db folder is ignored by git. After mv db is created, mv db is ignored by git. You can add “IFEXISTS=TRUE” to your database URL.Then Ebean connects to database only if it exists. By doing this your can avoid automatically creating of mv db.

Vidura Mudalige
  • 810
  • 2
  • 18
  • 31