hibernate - Could not set field value [49] value by reflection -
could me issue, having spring boot 1.5.2 based project?
i have parent , categories entities parent, straightforward one, has:
@id @generatedvalue @column(name = "parent_id") private long id; @jsonmanagedreference @onetomany(mappedby = "parent", fetch = fetchtype.lazy) @cascade({org.hibernate.annotations.cascadetype.save_update, org.hibernate.annotations.cascadetype.delete, org.hibernate.annotations.cascadetype.merge, org.hibernate.annotations.cascadetype.persist, org.hibernate.annotations.cascadetype.delete_orphan}) private list<category> categories; public list<category> getcategories() { return categories; } public void setcategories(list<category> categories) { this.categories = categories; } ...setters, getters, etc }
categories table has composite key (parent_id, category_code) defined embeddable class
@embeddable public class categorykey implements serializable { private string categorycode; private long parentid; ... getters, setters, overriden equals , hashcode method }
in category entity have
public class category implements serializable { @embeddedid private categorykey categorykey; @jsonbackreference @manytoone @mapsid("parentid") @joincolumn(name = "parent_id", insertable = false, updatable = false) private parent parent; ... getters, setters,no-arg constructor }
when try issue post operation save new parent, throws
could not set field value [here new parent_id] value reflection
how overcome issue?
Comments
Post a Comment