Many apologies, I completely misread your first post. Sorry for wasting all that time. I'll wear a pointy hat with a big "D" on it and sit in the corner all morning.
I have a question about your sample java code:
Code:
User us1= (User ) sess.get(User .class,new Integer(0));
assertTrue(us1A.getFriends().size==0)
User us2= (User ) sess.get(User .class,new Integer(298));
assertTrue(us1!=null && us2!=null);
us.getFriends().add(us2);
sess.saveOrUpdate(ut);
I'm guessing that there are some typos in here? Do you have the correct references to us1 the whole way through, or do you really have those mistakes with variables? You refer to us1A even though it's not loaded until later, and there's a variable "us" that isn't mentioned anywhere else. First thing to do is to rerun your code with the correct variables, if they're wrong. You should also put a sess.flush after the saveOrUpdate.