snpesnpe wrote:
double delete isn't error - you will do nothing second time, only
try from sql tool (sqlplus or mysql, psql tool )
delete from table
where id='nonexists'
you get only 0 rows deleted or like message and no error
At the SQL level (using sqlplus or whatever) you are certainly right.
But at the Hibernate API level this is not always the case;
As I said before, the following code:
Code:
// first delete
HibernateUtil.getSessionFactory().getCurrentSession().delete(entity);
// double delete
HibernateUtil.getSessionFactory().getCurrentSession().delete(entity);
will pass without any error when the underlying database is Oracle9i but it will throw a StaleStateException with MySQL.
In this precise case, Hibernate exibit different behaviors depending on the underlying database. Isn't it a code smell ? I am just asking.