// The new membership is transient (it has a null surrogate ID), so
// Hibernate assumes that it should be added to the collection.
// Inserts are done before deletes, so a ConstraintViolationException
// will be thrown on the insert because the unique constraint on the
// user and group IDs in the join table is violated. See HHH-2801.
s.merge( getUser() );
s.getTransaction().commit();
fail( "should have failed because inserts are before deletes");
}
catch( ConstraintViolationException ex ) {
// expected