Hi there,
I think the first code block has an error (page 334):
session.load(User.class, user);
should be
User user2 = (User) session.load(User.class, user);
or
user = (User) session.load(User.class, user);
I'm not sure about this though, because the way it is written in the book makes you think that 'user' gets populated by session.load (there is a comment above that line that says 'Load persistent state into user'
However, i tried to make it work that way and 'user' only had the two values for the composite key as a result of calling session.load. the other attributes were not retrieved from the DB. It worked when I did the modification specified above.
Thanks
Juan
|