Hi!
I'm trying to duplicate entries of a table into same table resetting a field
(ie duplicate redors of ITEM table setting a new value for ITEM_TYPE)
I try this:
Session session = sessionFactory.openSession();
Transaction tx = session.beginTransaction();
String sqlH ="insert into Item(name, description, item_type Select i.name, i.description, :newItemType from Item i where i.itemType=:oldItemType";
q = s.createQuery(sqlH);
q.setParameter("newItemType ", newType);
q.setParameter("oldItemType", oldType);
q.executeUpdate();
but it doesn't work!
Any idea??
|