Hibernate version:
2.1.4
What happens if I delete a newly created entity before flushing, ie:
Code:
session.save(entity);
session.delete(entity);
session.flush();
Testing indicates that Hibernate tries to insert the entity and then delete it from database, which is quite unnecessary.
Is this the expected behaviour?
Of course the code sequence is crazy if it would occur in one spot but in our case the method that calls delete has no idea if the object has been previously flused or not. To avoid the above sequence we would have to keep some kind of entity state in application code which seems out of place, it feels like this should be the responsiblity of the ORM.
/Peter