rhasselbaum wrote:
I believe they are the same, but not 100% sure. However, another factor to consider is that delete(String) essentially defeats optimistic locking.
I'm not sure if this is correct. As far as I am aware delete( String ) is roughly the same as doing
Code:
List results = session.find( string );
for ( Object results : results )
{
session.delete( result );
}
So the locking check will be done in the delete as the object has been loaded.
To answer the original question, delete( Object ) will generally be faster as it does not query the database.[/code]