From: Urberg, J. <ju...@ve...> - 2002-08-14 20:51:03
|
It happens in both 1.01 and 1.1 beta 4. -----Original Message----- From: Urberg, John Sent: Wednesday, August 14, 2002 3:49 PM To: 'Gavin_King/Cirrus%CI...@ci...' Cc: hib...@li... Subject: RE: [Hibernate-devel] Update problems More details. This happens when there is a flush after the load. I had left part of the function out to be brief. Here is the whole function: Message message = null; MessageBoxEntry entry = (MessageBoxEntry)session.load(MessageBoxEntry.class, aMessageBoxEntryId); if (entry != null) { message = entry.getMessage(); if (!entry.isRead()) { entry.setRead(Boolean.TRUE); session.update(entry); session.flush(); //*** should only update the read_flag field on message_box_entry } } return message.getText(); Do I need to do the update in a seperate session from the load to make this work? Thanks, John -----Original Message----- From: Gavin_King/Cirrus%CI...@ci... [mailto:Gavin_King/Cirrus%CI...@ci...] Sent: Tuesday, August 13, 2002 10:42 PM To: Urberg, John Cc: hib...@li... Subject: Re: [Hibernate-devel] Update problems >1) I have a class with a collection. When I load the class, hibernate tries >to update the foreign key on the collection table (and tries to set it to >NULL no less). Here's the mapping: John, I have spent a couple of hours playing around with two different versions of Hibernate and I just can't reproduce this... (1) Are you really, really certain you don't meddle with the collection somewhere? On the basis of the code you presented, the lazy="true" collection should not even be getting *initialized*, let alone removed! (2) Could you please forward me the all the code which is needed to reproduce this very naughty behaviour. (3) Could you let me know which version I am meant to be testing against. Please get back to me ASAP because this is playing on my mind.... Thanks Gavin. |