結合テーブルを使用した 1 対多のマッピングがあります。
class service{private Long service_id}
class codes{private Long code_id}
サービスとコード クラスは休止状態のエンティティとして設定され、ID のミューテーターがあります。
結合テーブル
table servicecodes
(serviceid,
codeid);
私のサービスクラスのマッピング:
<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>
私のアプリケーション層には次のものがあります。
serviceobj.set(Set<Codes>);
...
session.save(serviceobj);
session.save 行で、次のエラーがスローされます。
org.hibernate.PropertyAccessException: could not get a field value by 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 to java.lang.String