Answer the question
In order to leave comments, you need to log in
Why does the query fail?
I use H2, Spring and Hibernate. The query is extremely simple "select v from LegalEntity as v". Those. select all data from the table. And here is another table schema if necessary, also very simple:
create table if not exists LegalEntity (
id int primary key auto_increment,
version int not null,
name varchar(50) not null,
inn varchar(50) not null
);
org.springframework.web.util.NestedServletException: Request processing failed; nested exception is org.springframework.dao.InvalidDataAccessResourceUsageException: could not prepare statement; SQL [select legalentit0_.id as id1_2_, legalentit0_.inn as inn2_2_, legalentit0_.name as name3_2_, legalentit0_.version as version4_2_ from legal_entity legalentit0_]; nested exception is org.hibernate.exception.SQLGrammarException: could not prepare statement
em.createQuery("select v from LegalEntity as v", LegalEntity.class).getResultList();
Answer the question
In order to leave comments, you need to log in
Do you have such a table in your database file? Make sure of this, and also that her name is correctly mapped.
PS Your mistake here it is -
Caused by: org.h2.jdbc.JdbcSQLException: Таблица "LEGAL_ENTITY" не найдена
Table "LEGAL_ENTITY" not found; SQL statement:
select legalentit0_.id as id1_2_, legalentit0_.inn as inn2_2_, legalentit0_.name as name3_2_, legalentit0_.version as version4_2_ from legal_entity legalentit0_
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question