Hibernate Exceptions Errors and Causes
The following section will list the general exception that we get while dealing with hibernate. org.hibernate.ObjectDeletedException:deleted object would be re-saved by cascade when we try to delete the child object and don't remove the association, for instance we loaded a parent object with list of child and then we deleted one of the child object but did not removed the child from the parent. Example, Box gotBox =(Box)dao.load(Box.class, box.getBoxId()); List boxitem = new ArrayList(gotBox.getBoxItems()); BoxItem deleteItem = boxitem.get(0); dao.deletItem(deleteItem.getItemName()); Solution is, remove the transient instance from the parent object(Box) like. gotBox.getBoxItems().remove(deleteItem); OR use @Cascade(value=org.hibernate.annotations.CascadeType.DELETE_ORPHAN) on the child object. ------------------------------------------------------------------------------------------------- No Dialect mapping for JDBC type: -1 We get this ex