-->
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.  [ 4 posts ] 
Author Message
 Post subject: Hibernate 3.2.x to 5.2.x : Naming strategy incompatibility
PostPosted: Tue May 02, 2017 1:35 pm 
Newbie

Joined: Tue May 02, 2017 1:19 pm
Posts: 2
Dear all,
the strategy for naming foreign keys has changed in hibernate 5.2.x when compared to Hibernate 3.2.6.
I need a way to have a naming strategy that is compatible with the one used in 3.2.6. I've checked the legacy hbm naming strategy, but that strategy produces different naming for foreign keys.
To be clear, I need a naming strategy that produces foreign keys like the following one:

FK8FEF1913C6FD77C9

Does Hibernate 5.2.8 ship such a legacy naming strategy?

Thanks in advance for your help!

A.


Top
 Profile  
 
 Post subject: Re: Hibernate 3.2.x to 5.2.x : Naming strategy incompatibility
PostPosted: Tue May 02, 2017 2:59 pm 
Hibernate Team
Hibernate Team

Joined: Thu Sep 11, 2014 2:50 am
Posts: 1628
Location: Romania
Try with the legacy-hbm ImplicitNamingStrategy.

Otherwise, you can also check the migration guides for more info.


Top
 Profile  
 
 Post subject: Re: Hibernate 3.2.x to 5.2.x : Naming strategy incompatibility
PostPosted: Tue May 02, 2017 7:22 pm 
Newbie

Joined: Tue May 02, 2017 1:19 pm
Posts: 2
As written in the original post

Quote:
I've checked the legacy hbm naming strategy, but that strategy produces different naming for foreign keys.


I checked the code:
ImplicitNamingStrategyLegacyHbmImpl extends ImplicitNamingStrategyJpaCompliantImpl but *does not* override the determineForeignKeyName method
which is used afaiu to compute foreign key constraint names and, as such, is backward incompatible.

https://github.com/hibernate/hibernate- ... .java#L200
https://github.com/hibernate/hibernate- ... mImpl.java


Top
 Profile  
 
 Post subject: Re: Hibernate 3.2.x to 5.2.x : Naming strategy incompatibility
PostPosted: Wed May 03, 2017 1:44 am 
Hibernate Team
Hibernate Team

Joined: Thu Sep 11, 2014 2:50 am
Posts: 1628
Location: Romania
You can open a Jira issue and we shall see if the legacy-hbm needs to be changed or a new naming strategy should be provided. I checked in Hibernate 4.3, ana the Foreign Key prefix was "FK_", so this was changed a long time ago.

You should debug it and provide the logic that was used back then. You could also submit a Pull Request, since this is the fastest way to get a fix done.


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

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.