i have 1 many mapping join table.
class service{private long service_id} class codes{private long code_id}
the service , code classes setup hibernate entities , have mutators ids.
the join table
table servicecodes (serviceid, codeid);
my service class mapping:
<class name="path.to.service" table="service" lazy="false"> <set name="sc" table="servicecodes"> <key column="serviceid"/> <many-to-many column="codeid" unique="true" class="path.to.codes"/> </set> </class>
in application layer have:
serviceobj.set(set<codes>); ... session.save(serviceobj);
at session.save line, following error thrown:
org.hibernate.propertyaccessexception: not field value reflection getter of path.to.codes.code_id .... caused by: java.lang.illegalargumentexception: can not set java.lang.long field path.to.codes.code_id java.lang.string
figured out myself. 'codes' class setup jpa annotations , annotations set on property declarations. setting annotations on getter methods of entity's properties solved issue.
Comments
Post a Comment