I've been struggling with this one for quite some time already. It appears a lot less simple than I thought it'd be:
<join table="COTISATION_SYNCHRO" fetch="join" optional="true">
<key column="COTISATION_SYNCHRO_COTISATION_ID_FK" on-delete="noaction"/>
<property name="cotisationCoupon" type="java.lang.Long" update="true" insert="true">
<column name="COTISATION_COUPON" not-null="true" unique="true"/>
</property>
<property name="synchroData" type="com.allence.opcapl.alpha2.common.model.synchro.SynchroDataType">
<column name="LAST_ACCESS_LOCAL" not-null="true"/>
<column name="LAST_UPDATE_LOCAL" not-null="true"/>
<column name="LAST_ACCESS_REMOTE" not-null="true"/>
<column name="LAST_UPDATE_REMOTE" not-null="true"/>
</property>
</join>
This is included in the COTISATION
table mapping and uses SynchroDataType
, extending Hibernate UserType
.
This works really great, but I can't find a way to translate it to proper JPA while keeping the convenience of it.
Does someone has a solution for that kind of one-to-one mapping?