java - spring data rest with CrudRepository with @Embeddable -
i got following simplified entities:
@data @entity public class salesprocess { private @id @generatedvalue long id; @manytoone private customer customer; private date nextcontactdate; private string nextcontactnote; @embedded @access(accesstype.property) private actualproduct actualproduct; private salesprocess() {} } @data @embeddable public class actualproduct { private string type; private date manufacturedate; private actualproduct() {} } this way have data bit separated though still in 1 table.
to rest endpoint create simple interface extending crudrepository:
public interface salesprocessrepository extends crudrepository<salesprocess, long> {} when request `http://localhost:8080/salesprocesses/1' correct response embedded type included that:
{ ... actualproduct: { type: 'some type', ... }, } my problem when try create new salesprocess executing post request server actualproduct embedded @ get response, every column embedded type null in database. rest endpoint returns 200.
funfact
i tried write custom controller , stored salesprocess salesprocessrepository. tested same query , works. dont know why spring-data-rest generated rest endpoint not store embedded type :(
Comments
Post a Comment