|
I use the following mapping that contains an entity that has a list valued property "attrStrList":
<class entity-name="t_d_TestAttrTypes" table="F5_T_D_TESTATTRTYPES" lazy="true"> <id name="_id" column="ID" type="long"> <generator class="native"/> </id> <list name="attrStrList" table="F5_T_D_TESTATTRTYPES_ATT_STRLIST" cascade="all"> <key column="OWNER_KEY"/> <list-index column="IDX"/> <element type="string"> <column name="VAL" sql-type="VARCHAR(32672)"/> </element> </list> ... other properties omitted ... </class>
Hibernate creates the corresponding tables:
create table F5_T_D_TESTATTRTYPES ( ID bigint generated by default as identity, ... other columns omitted ... primary key (ID) )
create table F5_T_D_TESTATTRTYPES_ATT_STRLIST ( OWNER_KEY bigint not null, VAL VARCHAR(32672), IDX integer not null, primary key (OWNER_KEY, IDX) )
alter table F5_T_D_TESTATTRTYPES_ATT_STRLIST add constraint FK_473oafth9e2oiuxjssina3ld4 foreign key (OWNER_KEY) references F5_T_D_TESTATTRTYPES
However, when an entity of type "t_d_TestAttrTypes" no entries are inserted into the collection table F5_T_D_TESTATTRTYPES_ATT_STRLIST.
I tried to debug the situation and found the following. When the save operation is called then in the class StatefullPersistenceContext an entry is added to the "collectionEntries" member. I guess that the corresponding operation (that persists the collection) should be executed after the collection owner is persisted. Yet this does not happen!
Has anyone a cluet why the stored collectionEntries member is not considered?
|