Вот упрощенная версия моего теста: < /p>
Код: Выделить всё
@Test
public void testEntityPersistence() {
Long entityId = 1L;
String category = "category1";
// This works - entity is persisted and ID is set
MyEntity entity = repo.saveEntity(entityId, category, 1,
LocalTime.now().minusMinutes(10), LocalTime.now().plusHours(2), "Asia/Kolkata");
// This fails with "Table not found" error
List entities = entityService.getEntities(entityId, category);
}
< /code>
Детали среды < /p>
app.datasource.driverClassName = org.h2.Driver
app.datasource.url = jdbc:h2:mem:test;DB_CLOSE_DELAY=-1
app.datasource.username = sa
app.datasource.password =
app.hibernate.database = H2
app.hibernate.dialect = org.hibernate.dialect.H2Dialect
app.hibernate.hbm2ddl.auto = update
app.hibernate.jdbc.time_zone = UTC
app.hibernate.show_sql=false
< /code>
Что я пробовал: < /p>
Добавление db_close_delay = -1 в URL H2 (уже присутствует) < /li>
Настройка hibernate.hbm2ddl.auto = create-drop вместо обновления < /li>
ate in transaction in informaction /> < /ul>
журналы: < /p>
Hibernate: drop table if exists my_entity CASCADE
Hibernate: create table my_entity (id bigint not null, created_at timestamp, updated_at timestamp, version integer, category varchar(255) not null, day integer not null, from_time time not null, to_time time not null, entity_id bigint not null, zone_id varchar(255) not null, primary key (id))
Hibernate: create index entityCategoryIndex on my_entity (entity_id, category)
Hibernate: insert into my_entity (created_at, updated_at, version, category, day, from_time, to_time, entity_id, zone_id, id) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
ERROR SqlExceptionHelper Table "MY_ENTITY" not found; SQL statement:
insert into my_entity (created_at, updated_at, version, category, day, from_time, to_time, entity_id, zone_id, id) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?) [42102-220]
Hibernate: drop table if exists my_entity CASCADE
Подробнее здесь: https://stackoverflow.com/questions/794 ... found-on-s