2

Firebird database supports read-only columns. Columns that have their values computed, not updated. If I map some table with read-only columns using MyBatis Generator I receive the following error while inserting into or updating the table:

org.firebirdsql.jdbc.FBSQLException: GDS Exception. 335544359. attempted update of read-only column.

How to treat this kind of column using MyBatis Generator? Is it possible to have insert and update statements ignoring this kind of column?

Note: Using insertSelective and updateSelective passing the read-only columns values as null, instead of using insert and update, will solve only the cases where I don't want to update other fields to null. So, I need another solution.

Italo Borssatto
  • 15,044
  • 7
  • 62
  • 88
  • I have never used MyBatis, but from a quick google it looks like it has no support for this. Maybe you should ask in the MyBatis google group: http://groups.google.com/group/mybatis-user – Mark Rotteveel Apr 06 '13 at 07:52

1 Answers1

1

MyBatis does not offer additional support to read-only columns. So, the turnaround solution is to set the read only columns with the ignoreColumn tag and to write the queries that need that column value manually, using @Select annotations in mappers.

<table tableName="...">
    ...
    <ignoreColumn column="<read only column>" /> 
    ...
</table>
Italo Borssatto
  • 15,044
  • 7
  • 62
  • 88