title: java h2 in-memory database error: Table not found
body: <p>I tried googling around, but the solution to almost all this kind of questions was to add <code>;DB_CLOSE_DELAY=-1</code>, however it does not solve anything for me. </p>
  
  <p>Here is my test class</p>
  
  <pre><code>@RunWith(SpringJUnit4ClassRunner.class)
  @ContextConfiguration(classes = {Main.class})
  public class Testas {
  
      @Autowired
      @Qualifier("managerImplementation")
      private ClassifierManager manager;
  
      @Test
      public void testManager(){
          ClassifierGroupEntity cge = new ClassifierGroupEntity();
          manager.saveClassifierGroup(cge);
      }
  }
  </code></pre>
  
  <p>Manager class</p>
  
  <pre><code>@Service("managerImplementation")
  public class ClassifierManagerImpl implements ClassifierManager{
  
      @Autowired
      private ClassifierGroupEntityRepository groupEntityRepository;
  
      @Autowired
      private ClassifierEntityRepository entityRepository;
  
      @Autowired 
      private ClassifierValueEntityRepository valueEntityRepository;
  
      @Override
      public ClassifierGroupEntity getClassifierGroup(long id) {
          return groupEntityRepository.findOne(id);
      }
  
      @Override
      public ClassifierGroupEntity getClassifierGroup(String code) {
          return groupEntityRepository.findByCode(code);
      }
  
      @Override
      public ClassifierGroupEntity saveClassifierGroup(ClassifierGroupEntity entity) {
          return groupEntityRepository.save(entity);
      }
  
      @Override
      public void deleteClassifierGroup(long id) {
          groupEntityRepository.delete(id);
      }
  
      @Override
      public ClassifierEntity getClassifier(long id) {
          return entityRepository.findOne(id);
      }
  
      @Override
      public ClassifierEntity getClassifier(String code) {
          return entityRepository.findByCode(code);
      }
  
      @Override
      public ClassifierEntity saveClassifier(ClassifierEntity entity) {
          return entityRepository.save(entity);
      }
  
      @Override
      public void deleteClassifier(long id) {
          entityRepository.delete(id);
      }
  
      @Override
      public ClassifierValueEntity getClassifierValue(long id) {
          return valueEntityRepository.findOne(id);
      }
  
      @Override
      public ClassifierValue getClassifierValue(String classifiedCode, String valueCode) {
          return null;
      }
  
      @Override
      public ClassifierValueEntity saveClassifierValue(ClassifierValueEntity entity) {
          return valueEntityRepository.save(entity);
      }
  
      @Override
      public void deleteClassifierValue(long id) {
          valueEntityRepository.delete(id);
      }
  
  
  }
  </code></pre>
  
  <p>And finally properties file</p>
  
  <pre><code>spring.datasource.driver-class-name=org.h2.Driver
  spring.datasource.user=sa
  spring.datasource.password=
  spring.datasource.url=jdbc:h2:mem:test;DB_CLOSE_DELAY=-1
  </code></pre>
  
  <p>Launching the test throws me </p>
  
  <pre><code>org.h2.jdbc.JdbcSQLException: Table "CLASSIFIER_GROUP_ENTITY" not found; SQL statement:
  insert into classifier_group_entity (id, code, modified_details, modified_time, modified_user_id, order, revision, valid_details, valid_from, valid_till, parent_id) values (null, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) [42102-191]
  </code></pre>
  
  <p>I don't know if I should provide anything else, please tell me if I do. I appreciate your help in advance.</p>