Skip to content
Advertisement

Spring Hibernate SQL Server – problem in updating columns

I get the below error while not updating the mentioned column at all. I only update two another columns that one of them is used to compute the column “Available”.

The column “Available” cannot be modified because it is either a computed column or is the result of a UNION operator.

I also used native query (as below) to be sure that there is no problem during translating hql to sql, but the problem still exists

JavaScript

Here is my model(table) definition:

JavaScript

My hibernate Configuration is as below:

JavaScript

Also my table definition in SQL Server is as below:

JavaScript

Advertisement

Answer

My problem was solved when I added @Generated tag as below:

JavaScript

But I can’t understand why ?!!! (because it does not seem to be mandatory specially when I use native query)

User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement