Hi,
Both of your sets for the many-to-many mapping have "inverse" set to true.
What the "inverse" does is that it tells hibernate to ignore it. Consider it a mirror of the other side. Since both sides have it set to true, nothing happens to the mapping (the PROFILE_CAPABILITY table is not updated). Likewise, if both sides are set to false, it will try to insert into the PROFILE_CAPABILITY table twice and you'd get an exception in that case.
So try setting inverse="false".
In fact you don't need the session.updates() in your code. You should be able to achieve what you need with the following:
Code:
Capability capab1 = new Capability();
capab1.setIdCapability("c4");
capab1.setDescription("d2");
Profile profile1 = new Profile();
profile1.setProfileName("P4");
profile1.setDescription("d2");
profile1.setSincro('1');
profile1.getCapabilities().add(capab1);
capab1.getProfiles().add(profile1);
session.save(profile1);
You don't even need to save capab1. The save of profile1 will cascade to the save of capab1 and should create the entry in PROFILE_CAPABILITY table since you have cascade="save-update"
Budyanto