There is a Spring Boot database application, in this case h2. When executing tests to check the performance of methods for interacting with the database, an exception appears:


Caused by: org.h2.jdbc.JdbcSQLException: Table "OFFICE" not found Table "OFFICE" not found; SQL statement: insert into office (office_id, office_address, office_is_active, office_name, office_org_id, o_id, office_phone, version) values ​​(null,?,?,?,?,?,?,?) [42102-193]


What could be the problem? The full code is on the git: https://github.com/kaldihin/Bell_Integrator_Task.git


Any variants of guesses and answers, as well as valid criticism are welcome :)

    1 answer 1

    The table was not found, because in your Hibernate settings it is indicated that the schema does not need to be created / updated.

    spring.jpa.hibernate.ddl-auto=none 

    This may be the reason why tests do not pass. Change the settings so that the scheme is automatically created using the following configuration

     spring.jpa.hibernate.ddl-auto=create 
    • When set to "none", the default should be to create tables from schema.sql and data.sql from the resource directory? - Eugene Kaldihin
    • Why could such a thing come from? - Roman C