Hi,
I've got a class Actor and a class File. Each file is opened by one Actor, while an Actor can open multiple Files. Here are parts of the mapping files for both classes:
Code:
<class name="Actor" table="actors">
<id name="id" column="id" type="long">
<generator class="sequence">
<param>actors_id_seq</param>
</generator>
</id>
<property name="firstName" column="firstname" type="string" />
<property name="lastName" column="lastname" type="string" />
</class>
Code:
<class name="File" table="file">
<id name="id" column="id" type="long">
<generator class="sequence">
<param>file_id_seq</param>
</generator>
</id>
<property name="dateClosing" column="date_closing"/>
<many-to-one name="openedBy" column="opened_by" class="be.arafox.sheria.business.Actor"/>
</class>
I get an Actor object from the DB (PostgreSQL 7.2), using the find-method, and use the method setOpenedBy(Actor actor) to link it to the File object. Now when I save the File object, it says i'm trying to assign null to the column opened_by. It seems there is a problem on the mapping layer, but I have no idea what. Somebody could hive me hint? I'm using Hibernate 1.1.