Here is my java code:
Item item = new Item();
item.setName("Odissea nello spazio");
Session session = HibernateUtil.currentSession();
tx = session.beginTransaction();
session.saveOrUpdate(item);
item.setDescription("libro");
tx.commit();
This code is resolved in one SQL INSERT and one SQL UPDATE, instead i expected only 1 INSERT.
Here is the log of the sql:
[main] Hibernate: insert into ITEMS (name, description) values (?, ?)
[main] Hibernate: update ITEMS set name=?, description=? where item_id=?
Do you think i missed some configuration or approach, or is this what hibernate is expected to do?
|