Details
-
Bug
-
Status: Open
-
Major
-
Resolution: Unresolved
-
3.1.2, 3.2.0
-
None
-
None
Description
Hi,
On a property field (locations) that is a Map<C1, C2> where C1 has a id class (composite key) that is an embeddable:
But now if I try to apply the following mapping:
<entity class="Sequence">
<table name="sequences" />
<attributes>
<id name="id">
<column name="sequence_id" />
<generated-value strategy="IDENTITY" />
</id>
<many-to-many name="locations">
<map-key-join-column name="numacc" />
<map-key-join-column name="feanum" />
<join-table name="locations">
<join-column name="sequence_id" />
<inverse-join-column name="class_id" />
</join-table>
</many-to-many>
</attributes>
</entity>
Mapping is like loosing the "numacc" column while trying to insert values:
Caused by: <openjpa-3.2.0-r6f721f6 fatal general error> org.apache.openjpa.persistence.PersistenceException: (conn=64888979) Field 'numacc' doesn't have a default value {prepstmnt 2064897338 INSERT INTO imgt2.locations (sequence_id, class_id, feanum) VALUES (?, ?, ?)} [code=1364, state=HY000]
It is remaining me an old issue #1893 of mine where also some columns were lost in translation.
I admit myself being a little lost in among all the <map-key-*> elements. Am I doing it right?
A current working solution is to not have the 2 elements <map-key-join-column /> in the mapping and use the default JPA column names that are 'key0_numacc' and 'key0_feanum' as the physical column names in the corresponding table. But this is not the expected solution.
Thanks,
Patrice