HAllo zusammen.
Wie im Titel schon zu lesen bekomme ich folgende Exception :
Hier ist meine Application KLasse :
Und hier meine schema.sql
HAt jemand eine Idee warum die TAbellle nicht gefunden wird `?
Wie im Titel schon zu lesen bekomme ich folgende Exception :
Java:
Caused by: org.h2.jdbc.JdbcSQLSyntaxErrorException: Tabelle "employeeProfile" nicht gefunden (m÷gliche Kandidaten: "EMPLOYEEPROFILE")
Table "employeeProfile" not found (candidates are: "EMPLOYEEPROFILE"); SQL statement:
INSERT INTO "employeeProfile" ("EMPLOYEE", "PASSWORD", "USERNAME") VALUES (?, ?, ?)
Hier ist meine Application KLasse :
Java:
public class SpringDataJdbcApplication {
public static void main(String[] args) {
SpringApplication.run(SpringDataJdbcApplication.class, args);
}
@Bean
ApplicationRunner demo(EmployeeRepository repository) {
return args -> {
var employee = repository.save(new Employee(null, "Employee A", new Profile(null, "username", "password")));
repository.findAll().forEach(System.out::println);
};
}
}
@Table(name = "employeeProfile")
record Profile(@Id Integer id, String username, String password) {
}
record Employee(@Id Integer id, String name, Profile profile) {
}
interface EmployeeRepository extends ListCrudRepository<Employee, Integer> {
}
Und hier meine schema.sql
SQL:
CREATE TABLE employee (
id integer generated by default as identity primary key,
name text
);
CREATE TABLE employeeProfile(
id integer generated by default as identity primary key,
employee bigint not null references employee(id),
username text,
password text
)
HAt jemand eine Idee warum die TAbellle nicht gefunden wird `?