title: hibernate many to many must use flush () function to send it to database?
body: <p>For example
  User user = new User (); Role role = new Role ("test"); HashSet  mList = new HashSet  (); user.setRoles (mList); userDao.save (user);
  When userDao call transaction commit time, role can also automatically save. However. sql manytomany relationship between user and role must be submitted to the database before calling session.flush behind. I know that the content is stored in the session cache. But why must flush to submit? This is a mechanism to hibernate? Or that I saved the wrong way?</p>