I'm trying to do a conditional update where my code looks something like:
Code:
final String hql = "update myClass obj set obj = :obj where obj.id=:id and obj.hash=:hash";
final Query query = txn.getSession().createQuery(hql);
query.setParameter("obj", myObject)
.setInteger("id", myObject.getId())
.setLong("hash", initialHash);
int updatedRecords = query.executeUpdate();
This does the conditional part just fine, but the
Code:
set obj = :obj
part gets turned into the sql
Code:
set idGroup=?
Is there a way for me to have
Code:
set obj = :obj
set the entire object? is there some other grammar to do so?
Thanks.