Hi,
I am trying to map a property to a computed column. The column is computed on the DB.
I have tried setting both update/insert to false, but I get a "cannot be used in an IF UPDATE clause because it is a computed column." error after updating the entiy. I am assuming because the DB updates the value but hibernate can't figure out that the value has changed and needs to update it.
I have also tried setting the "formula" attribute on the property in my mapping to the same logic that my DB uses (simple case statement), but this return the same error when I try to update.
Here is my mapping with the formula attr:
Code:
<property name="accurate" column="isAccurate" update="false" insert="false" formula="(CASE WHEN StatusID IN (2,3,4) THEN 0 ELSE 1 END)"/>
Any ideas? Can hibernate handle columns computed by the DB? The DB is shared with other apps, so it is not possible for the logic to be taken out of the DB and just left to exist in my mapping.
Thx in advance,
James