I am trying to create an HQL Update statement and would like someone to provide me an example with a simple join on another table.
Here is the basic example I am looking for:
update tablea
set cola
where tablea.cola = tableb.cola
and tablea.colb = tableb.colb
Any help is appreciated.
Joe
I found a way that works and I am posting it in case someone needs an example.
String queryString = "update CustomAttributeInstance" +
" set VALUE = '" + value + "'" +
" where ATTRIBUTE||MODULE in (select ATTRIBUTE||MODULE " +
" from CustomAttributes where ATTRIBUTE_DATATYPE = 'String')" +
" and ROLE_ID = ? and JOURNAL_CODE = ? " +
" and MODULE = ? and ATTRIBUTE = ?" ;
Query queryObject = getSession().createQuery(queryString);
queryObject.setParameter(0, new Integer(role_id));
queryObject.setParameter(1, journal_code);
queryObject.setParameter(2, module);
queryObject.setParameter(3, attribute);
queryObject.executeUpdate();
|