Hello together...
I got a problem with hibernate and flushing objects. For example, I create a number of new objects and use the "Save" method of the current Session to indicate to hibernate, that those are new instances. When I'm done with my loop, I use a flush() to write the data to the database. However, only the last created object becomes persistent.
The same happens, if I first delete an object from the database (using delete on the session) and then re-create the object. When I do a flush then, I get a key violation, because the object was never deleted. Shouldn't the flush remember that I wanted to delete the object and do that first, prior to do the insert?
Does anyone have an idea how to fix this behaviour? It's kinda pointless if I have to do a flush after every command.
Kind regards, Marco...
|