Hibernate with native SQL
Posted on 2009-03-31
i need to regularly update a timestamp attribute in a mysql table, while that table is not a hibernate-mapped entity class.
the SQL is something like
UPDATE mytable SET tstamp = NOW() where attr1 = val1 AND attr2 = val2
i don't want to introduce a new hibernate mapped entity just for this single statement. how can i use native SQL within a hibernate query/transaction (that updates other, hibernate-mapped tables)?