Hi, hibernate newbie here. I'm having problem with the use of naming strategy, wherein according to hibernate docs, it should generate a foreign key column name with the format "name of the relationship in the owner side, _ (underscore), and the name of the primary key column(s) in the owned side", i.e. entity_id. When naming strategy was not specified leaving hibernate to use DefaultNamingStrategy, it behaves correctly, but when I tried to specify the naming strategy, this time with ImprovedNamingStrategy, it generates wrong column name, i.e. expected was "entity_id", it only generates "entity".
I'm using Maven2 plugin hibernate3 - hbm2ddl for generating the schema.
Hibernate version: hibernate-3.2.1.ga, hibernate-annotation-3.2.1.ga
The generated SQL (show_sql=true):
alter table gateway_type_test drop constraint FKB0101E3CA31F223D;
drop table gateway_test;
drop table gateway_type_test;
create table gateway_test ( id int identity not null, name varchar(255) not null, description varchar(255) null, ssl tinyint not null, port int not null, user_name varchar(255) null, password varchar(255) null, sms_api_id varchar(255) null, primary key (id) );
create table gateway_type_test ( id int identity not null, name varchar(255) not null, gateway int null, primary key (id) );
alter table gateway_type_test add constraint FKB0101E3CA31F223D foreign key (gateway) references gateway_test;
|