I implement an example of Spring Boot with Graphql by using the h2 database.
After I ran the program, I tried to create all tables automatically but I have a problem there.
I didn't solve it although I redefined the URL in application.yml and gave the name for each entity.
Here is my application.yml file which is shown below.
spring:
application:
name: springbootgraphql
datasource:
url: jdbc:h2:mem:testdb;DATABASE_TO_UPPER=false;DB_CLOSE_DELAY=-1
driverClassName: org.h2.Driver
username: sa
password: password
hikari:
connection-timeout: 2000
initialization-fail-timeout: 0
jpa:
database-platform: org.hibernate.dialect.H2Dialect
properties:
hibernate:
ddl-auto: update
show_sql: true
format_sql: true
enable_lazy_load_no_trans: true
generate-ddl: true
h2:
console:
enabled: true
server:
port : 8081
# http://localhost:8081/graphql
graphql:
servlet:
mapping: /graphql
Here is my error which is shown below.
Caused by: org.h2.jdbc.JdbcSQLSyntaxErrorException: Table "hospital" not found; SQL statement:
insert into hospital (id, name) values (1, 'Hospital 1') [42102-200]
Here is my project link : My Project
How can I fix it?