Не удалось обновить JPA при начальной загрузке - PullRequest
0 голосов
/ 11 октября 2019

Не удалось обновить репозиторий JPA.

following code of service not works. insert works

 sping boot 2.1.7

 @Override
 @Transactional
 public Employee updateEmployee(Employee emp, long id) throws Exception {
    System.out.println("Repository emp" + emp.getPlantModel() + " id " + id);
    // return employeeRepository.save(emp);
    Optional<Employee> employee = employeeRepository.findById(id);
    System.out.println("plant make" + emp.getPlantMake());
    System.out.println("emo is present" + employee.isPresent());
    if (employee.isPresent()) {
        Employee newEntity = employee.get();
        newEntity.setPlantMake(emp.getPlantMake());
        newEntity.setPlantModel(emp.getPlantModel());
        System.out.println("updating employee entity");


        return  employeeRepository.save(newEntity);
    } else {
        return null;
    }

}

вставка работает, обновление jpa выдает исключение без какой-либо существенной причины.

сущность классифицируется следующим образом. Я подключился к postgresSQL

public class Employee implements Serializable {

private static final long serialVersionUID = 1L;

@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "emp_id", columnDefinition = "serial")
private long empId;

@Column(name = "plant_make")
private String plantMake;

ищу решение с пружинным башмаком 2.17

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...