You cannot do it using hateos cause the post request will try to link these child entities using the link you provided “http://localhost:8080/api/materials/1”
the other option is to put the whole entity, but it also will not succeed without providing the id, it will rather create a new entity.
After issuing the “post” request, it will first search for the ID or maybe also the version, if you provided one, and if nothing found it will create a new child entity
CLICK HERE to find out more related problems solutions.