.saveOrUpdate() issues sql statements but data is missing in table

Edit: After some more debugging, I have changed the description of this question

In Hibernate 5.6 with Spring 5.3 I have very weird issue. I want to insert a new user role into a table. i can see the insert-statement in console log but the data never appears in the table.

The table:

CREATE TABLE public.ums_t_user_role (
	fk_role_id int8 NOT NULL,
	fk_user_id varchar(500) NOT NULL,
	CONSTRAINT user_role_combine_key PRIMARY KEY (fk_role_id, fk_user_id)
);

The .hbm.xml mapping:

<hibernate-mapping>
    <class name="com.myapp.ums.business.impl.UmsUserRoleVOImpl" table="ums_t_user_role"
           proxy="com.myapp.ums.common.business.UmsUserRoleVO">
        <composite-id>
            <key-property name="userName" type="java.lang.String" column="fk_user_id"/>
            <key-property name="roleName" type="java.lang.Long" column="fk_role_id"/>
        </composite-id>
    </class>
</hibernate-mapping>

The business logic:

UmsUserRoleVO userRole = new UmsUserRoleVOImpl();
userRole.setUserName(userVO.getLoginId());
userRole.setRoleName(Long.valueOf(role));
this.userRoleDAO.save(userRole);

The userRoleDAO:

@Override
public final void save(final ENTITY instance) {
    	getHibernateTemplate().saveOrUpdate(instance);
    	getHibernateTemplate().flush();
}

When I hit the userRole.DAO method, I can see that the select + insert statements are generated in console. But the data is missing in the table. Any idea what the issue could be here?

											Hibernate:
13:05:33,583 INFO  [stdout] (default task-7)     select
13:05:33,583 INFO  [stdout] (default task-7)         umsuserrol_.fk_user_id,
13:05:33,583 INFO  [stdout] (default task-7)         umsuserrol_.fk_role_id
13:05:33,583 INFO  [stdout] (default task-7)     from
13:05:33,583 INFO  [stdout] (default task-7)         ums_t_user_role umsuserrol_
13:05:33,583 INFO  [stdout] (default task-7)     where
13:05:33,583 INFO  [stdout] (default task-7)         umsuserrol_.fk_user_id=?
13:05:33,583 INFO  [stdout] (default task-7)         and umsuserrol_.fk_role_id=?
13:05:33,583 INFO  [stdout] (default task-7) Hibernate:
13:05:33,583 INFO  [stdout] (default task-7)     insert
13:05:33,583 INFO  [stdout] (default task-7)     into
13:05:33,583 INFO  [stdout] (default task-7)         ums_t_user_role
13:05:33,583 INFO  [stdout] (default task-7)         (fk_user_id, fk_role_id)
13:05:33,583 INFO  [stdout] (default task-7)     values
13:05:33,583 INFO  [stdout] (default task-7)         (?, ?)

Did you commit the transaction?

This turned out to be a non-hibernate issue. I can see in the Postgres logs that the insert command was issued as it should but data remains missing. I created a clone of the table with the same structure but no data and added this new table to my .hbm.xml file and the data was written properly. Switched back to the old table - data not added. Will continue evaluation on DB level.

OK another addendum in case anybody every runs into this problem. I finally found in the postgres logs that after the insert to user_role table, another delete statement was issued that deleted the user role right away.

Problem was that I have three tables

user
roles
user_roles

And in my User.hbm.xml I have a set that tracks the assigned roles of that user

<set name="umsRoles" table="ums_t_user_role" inverse="false" lazy="false" fetch="select">
            <key property-ref="loginId">
                <column name="fk_user_id" not-null="true"  />
            </key>
            <many-to-many entity-name="com.myApp.ums.business.impl.UmsRoleVOImpl" >
                <column name="fk_role_id" not-null="true" />
            </many-to-many>
</set>

Problem was that we wrote the user_role directly to user_role table instead of just assigning that role to the umsRoles collection in UmsUserVOImpl and saving the user object. Hence, when saving the user, Hibernate wanted to keep the data consistent and removed all roles of that user again because the collection was empty.