Bug 1157597 - (6.3.z) HHH-9390 - Default join column name (FK) for @ManyToMany uses owning entity primary table name
Summary: (6.3.z) HHH-9390 - Default join column name (FK) for @ManyToMany uses owning ...
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: JBoss Enterprise Application Platform 6
Classification: JBoss
Component: Hibernate
Version: 6.4.0
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: CR1
: EAP 6.3.2
Assignee: Gail Badner
QA Contact: Jan Martiska
URL:
Whiteboard:
Depends On: 1154212
Blocks: eap632-blockers, eap632-payload 1145704
TreeView+ depends on / blocked
 
Reported: 2014-10-27 11:14 UTC by Gail Badner
Modified: 2019-08-19 12:39 UTC (History)
5 users (show)

Fixed In Version:
Clone Of: 1154212
Environment:
Last Closed: 2019-08-19 12:39:38 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)
reproducer (3.98 KB, application/zip)
2014-10-29 14:18 UTC, Jan Martiska
no flags Details


Links
System ID Private Priority Status Summary Last Updated
Red Hat Bugzilla 1158502 0 unspecified CLOSED [QE] (6.3.z) HHH-9461 - Cannot enable NamingStrategyDelegator implementations using entity manager 2021-02-22 00:41:40 UTC

Internal Links: 1158502

Description Gail Badner 2014-10-27 11:14:33 UTC
+++ This bug was initially created as a clone of Bug #1154212 +++

Description of problem:


Version-Release number of selected component (if applicable):


How reproducible:


Steps to Reproduce:
1.
2.
3.

Actual results:


Expected results:


Additional info:

--- Additional comment from Gail Badner on 2014-10-17 18:21:27 EDT ---

Description of problem:

The foreign key column name computed for a unidirectional @ManyToMany uses the owner table name instead of the owner entity name.

Version-Release number of selected component (if applicable):

Hibernate core 4.2 and later

How reproducible:
Consistently

Steps to Reproduce:
1. Provide a table name for an entity that differs from the entity name.

@Entity
@Table(name="tbl_city")
public class City {
    @Id
    private Integer id;

    @ManyToMany
    private Set<Item> stolenItems;

    ....
}

Actual results:
Hibernate 4 computes the foreign key column name as tbl_city_id

Expected results:
The foreign key column name should be City_id.

Additional info:
See https://hibernate.atlassian.net/browse/HHH-9390.

Comment 2 Jan Martiska 2014-10-29 14:18:35 UTC
Created attachment 951806 [details]
reproducer

Comment 3 Jan Martiska 2014-10-29 14:21:28 UTC
Partially fixed in Hibernate 4.2.14.SP4-redhat-1 (EAP 6.3.2.CR2).
'Partially' means using Hibernate API directly, not using Entity Manager. Another BZ is coming soon for that scenario.

Attached a reproducer I wrote, should anyone need it.
Note that there is 
configuration.setNamingStrategyDelegator(ImprovedNamingStrategyDelegator.DEFAULT_INSTANCE)
needed in order to activate the fix.


Note You need to log in before you can comment on or make changes to this bug.