cayenne-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Marco A Gonzalez <marco...@mac.com>
Subject Is it possible to have a read-only column in a Cayenne model?
Date Tue, 09 May 2017 22:09:52 GMT
Hi,
We’re using Cayenne 4.0 with PostgreSQL and for various reasons need to use a read-only
column whose value is calculated by a SQL function. 

Accessing the column value using a simple SELECT clause works great. Also, when generating
the SQL for an UPDATE statement, Cayenne is smart enough not to include the columns whose
values haven’t changed. Since we haven’t figured out how to mark a column as read-only
in Cayenne Modeler, Cayenne includes it when generating the SQL for the INSERT statement which
obviously fails (because there’s no place for the value to be stored).

Is there a way to mark a column as read-only, even if we have to edit the relevant XML file
by hand?
If this isn’t the way to do it, is there a way to tell Cayenne NOT to include the column
when generating the SQL for an INSERT/UPDATE statement?

- Marco A.



Mime
View raw message