It is not possible with one-to-many mapping. child should have a foreign key that references to the parent primary key.
Let's try to replace one-to-many mapping by many-to-one in parent:
Code:
<set name="children" lazy="true" inverse="true">
<key>
<column name="id2" />
</key>
<many-to-one class="com.*.persistence.Chield" property-ref="id2" />
/>
</set>
your child mapping should look like:
Code:
<composite-id>
<key-many-to-one name="parent" column="id2"/>
<key-property name="id3" column="id3" />
</composite-id>
<many-to-one name="parent" column="id2" insert="false" update="false"/>
<property name="id3" insert="false" update="false"/>