Is it possible to delete a foreign key using @DeleteMapping in java spring hibernate?

In other words change it to null on click. My reason for this is I have a main employees list and employees assigned to a project. I want to figure out a way to remove employees from the projects list without deleting them from the main total employees list as well.

For example this deletes an employee from the main list.

    @DeleteMapping("/jpa/users/{username}/employees/{employeeId}")
    public ResponseEntity<Void> deleteEmployee(
            @PathVariable String username, @PathVariable Long employeeId) {

        employeeJpaRepository.deleteById(employeeId);

        return ResponseEntity.noContent().build();
    }

But how do I delete the foreign key (projectId) of @DeleteMapping("/jpa/users/{username}/projects/{projectId}/employees/{employeeId}")?



from Recent Questions - Stack Overflow https://ift.tt/2Sdm9zK
https://ift.tt/eA8V8J

Comments

Popular posts from this blog

Today Walkin 14th-Sept

Hibernate Search - Elasticsearch with JSON manipulation

Spring Elasticsearch Operations