I've got a table on an Oracle 9i (9.2.0.1.0) with rather long column names, the longest of which is 29 characters. Oracle limits the name of a column to 30 characters.
When I use Hibernate to fetch a record from the table, it generates the following statement:
Code:
select statetra0_.STATE_TRANSITION_CONDITION_ID as STATE_TR1___,
operatio1_.OPERATION_NAME as OPERATION_NAME0_,
operatio1_.OPERATION_CLASS as OPERATIO2_0_,
statetra0_.STATE_TRANSITION_CONDITION_ID as STATE_TRANSITION_CONDITION_ID1_,
statetra0_.ELEMENT as ELEMENT1_,
statetra0_.PARAMETER as PARAMETER1_,
statetra0_.OPERATION_NAME as OPERATIO4_1_
from STATETRANSITIONCONDITION statetra0_
left outer join STATETRANSITIONOPERATION operatio1_ on statetra0_.OPERATION_NAME=operatio1_.OPERATION_NAME
where statetra0_.STATE_TRANSITION_ID=1001;
The problem is the STATE_TRANSITION_CONDITION_ID column. Hibernate tacks on 2 bytes for the column name, which exceeds Oracle's limitations and causes the statement to fail.
The obvious workaround is to simply shorten the column name, but I feel Hibernate should realise the generated columnname is too long and short it on its own.
Kind regards,
Cooper