Indexes in Firebird 2.0 and higher are limited by the page size: an index key cannot exceed 1/4 of the page size. For a page size of 4096 this means the index key length is max 1024 bytes, for a page size of 16384, it is 4096 bytes.
Your primary key (and its backing index) consists of the following columns:
element_codeId VARCHAR(30)
= 30 bytes (single byte charset) or 120 (UTF8)empPrd_emp_code VARCHAR(255)
= 255 bytes (single byte charset) or 1020 (UTF8)empPrd_emp_folder_codeId NUMERIC(18,0)
= 8 bytesempPrd_prd_exe_exercice INTEGER
= 4 bytesempPrd_prd_exe_folder_codeId
NOT LISTED, assuming it isempPrd_prd_exe_fdr_codeId NUMERIC(18,0)
= 8 bytesempPrd_prd_period INTEGER
= 4 bytes
This leads to a total index key of 309 (single byte charset) or 1164 (+ some extra bytes overhead for multiple columns, collation etc). With character set UTF8
and page size 4096 this exceeds the 1/4 of page size rule. The solution is to use a bigger page size for your database, or to use a single byte character set for the VARCHAR
columns.
As to the column names, the current limit for objectnames in Firebird is 31 characters (which is similar to Oracle's limitation of 30 bytes). The feature request to extend this (CORE-749) has been implemented for Firebird 4. As with other database with this limitation, you will need to provide an explicit column name using for example @Column(name="theshortername")
. Similar options exists for other objects.