I have an object called EmployeeDepartment as shown below
@IdClass(EmployeeDepartmentPK.class) //EmployeeDepartmentPK is a serializeable object @Entity EmployeeDepartment{ @Id private String employeeID; @Id private String departmentCode; ---- Getters, Setters and other props/columns }
and I have a Spring data repository as below
@RepositoryRestResource(....) public interface IEmployeeDepartmentRepository extends PagingAndSortingRepository<EmployeeDepartment, EmployeeDepartmentPK> { }
In addition, I have a converter registered to convert from String to EmployeeDepartmentPK.
Now for an object qualified by employeeID = "abc123" and departmentCode = "JBG", I expect the identifier to be used when the SDR interface is called, this is abc123_JBG. For example, http: // localhost / EmployeeDepartment / abc123_JBG should bring me the result, and it really is.
But when I try to save the object using PUT, the ID property available in the BasicPersistentEntity Spring Data Commons class has the value abc123_JBG for the department code. This is not true. I am not sure if this is the expected behavior.
Please, help.
Thanks!
spring spring-data spring-data-rest hibernate jpa
rakpan
source share