-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: NamingStrategy help
PostPosted: Tue Apr 24, 2007 9:27 pm 
Newbie

Joined: Tue Apr 24, 2007 8:34 pm
Posts: 4
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;



Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.