java h2路径_java h2内存数据库错误:找不到表

我试过谷歌搜索,但几乎所有这类问题的解决方案是添加; DB_CLOSE_DELAY = -1,但它并没有为我解决任何问题.

这是我的测试课

@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);

}

}

经理班

@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);

}

}

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

启动测试会让我失望

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]

我不知道是否应该提供其他任何东西,如果我这样做,请告诉我.我提前感谢您的帮助.

你可能感兴趣的:(java,h2路径)