Reputation: 21
I have a problem with saving entity to postgres // simple repository extending jpaRepository, service which has dependency to repository and controller having dependency to service When I send body in json from postman, Application crashes and writes : org.postgresql.util.PSQLException: ERROR: syntax error at or near "with"
@Repository
public interface EmployeeRepository extends JpaRepository<Employee, Long> {}
@Service
public class EmployeeService{
public void save(Employee employee){
employeeRepository.save(employee);
}}
@RestController
public class EmployeeController{
@PostMapping("/employees")
public void addEmployee(@RequestBody() Employee employee) {
employeeService.saveEmployee(employee);
}
}
@Entity
class Employee
employeeId;
firstName;
lastName;
departmentId;
jobTitle;
sample json in postman
{
"employeeId": 8,
"firstName": "johny",
"lastName": "walker",
"departmentId": 3,
"jobTitle": "DEV"
}
From where that "with" come from ? I don't use any query with "with" What do do to save entity to database?
Upvotes: 1
Views: 1798
Reputation: 21
Never mind, found the answer : I had not correct properties , just make 1 change and everything is ok :
spring.jpa.properties.hibernate.dialect = org.hibernate.dialect.PostgreSQLDialect
Upvotes: 1