Hi everyone, I have this problem when trying to make an update or a delete.
I use Spring to get along with the Sessions stuff, autocommit etc..
Hibernate version:
3.3.1
Mapping documents:
Code:
@Entity
@Table(name = "LIBRARYITEM")
@SuppressWarnings("serial")
public class Libraryitem implements Serializable {
//all the attributes...
@Basic
@Id
@GeneratedValue
@Column(name = "ITEMRECNUMBER")
public Integer getItemrecnumber() {
return itemrecnumber;
}
//Rest of getters and setters...
Code between sessionFactory.openSession() and session.close():Code:
//
public abstract class AbstractHibernateDAO<T, ID extends Serializable> extends HibernateDaoSupport implements GenericDAO<T, ID> {
//stuff..
public void update(T entity) {
getSession().update(entity);
}
//or
public void saveOrUpdate(T entity) {
getSession().saveOrUpdate(entity);
}
//or
public void delete(T entity) {
getSession().delete(entity);
}
Name and version of the database you are using:HSQL
The generated SQL (show_sql=true):When inserting.. I do got to see the SQL also when doing selects
Code:
20:59:27,564 DEBUG SQL:401 - /* insert biblioteca.pojo.Libraryitem */ insert into LIBRARYITEM (ITEMRECNUMBER, ITEMAUTHOR, ITEMBRIEFDESC, ITEMCALLNUMBER, ITEMCATEGORY, ITEMISBN, ITEMKEYWORD, ITEMLANGUAGE, ITEMLENGTH, ITEMMEDIATYPE, ITEMPUBLISHERNAME, ITEMSUBJECT, ITEMTITLE, ITEMTOTAVAILABLE, ITEMTOTBORROW, ITEMTOTQUANTITY, ITEMTOTRESERVE, ITEMYEAR) values (null, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
Hibernate: /* insert biblioteca.pojo.Libraryitem */ insert into LIBRARYITEM (ITEMRECNUMBER, ITEMAUTHOR, ITEMBRIEFDESC, ITEMCALLNUMBER, ITEMCATEGORY, ITEMISBN, ITEMKEYWORD, ITEMLANGUAGE, ITEMLENGTH, ITEMMEDIATYPE, ITEMPUBLISHERNAME, ITEMSUBJECT, ITEMTITLE, ITEMTOTAVAILABLE, ITEMTOTBORROW, ITEMTOTQUANTITY, ITEMTOTRESERVE, ITEMYEAR) values (null, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
But any time I do an update or delete.. it stays there..
Debug level Hibernate log excerpt:Code:
21:03:26,837 DEBUG SessionImpl:220 - opened session at timestamp: 12214442068
21:03:26,838 DEBUG IdentifierValue:104 - id unsaved-value: null
21:03:26,839 DEBUG AbstractSaveEventListener:523 - detached instance of: biblioteca.pojo.Libraryitem
21:03:26,840 DEBUG DefaultSaveOrUpdateEventListener:205 - updating detached instance
21:03:26,840 DEBUG DefaultSaveOrUpdateEventListener:272 - updating [biblioteca.pojo.Libraryitem#1]
21:03:26,847 DEBUG DefaultSaveOrUpdateEventListener:323 - updating [biblioteca.pojo.Libraryitem#1]
The update or delete just never gets executed
What could this be??
Thank you so much for your time
bye[/code]