Thank for your help. I have finnaly made it done.
The thing about setting the foreign key to "Null Allowed" was a good guess.
But I have notice that I cannot do an "executeQuery" of "delete from Job" because it will not use the "cascade=all" It seems that only a "delete(object)" will use the cascade all.
So this will not work because it will not use the "cascade=all" tag.
Code:
public void deleteAllJob(){
getHibernateTemplate().execute(new HibernateCallback() {
public Object doInHibernate(Session session){
return new Integer(session.createQuery("delete Job").executeUpdate());
}
});
}
But this one will work:
Code:
public void deleteAllEachJob(){
List l = getHibernateTemplate().loadAll(Job.class);
Iterator i = l.iterator();
while(i.hasNext()){
Job j = (Job) i.next();
getHibernateTemplate().delete(j);
}
}
The problem here is that it is a bit more slow than the batch delete.
Thanks
Etienne.