Bug 1154212 - (6.4.0) [HHH-9390] Default join column name (FK) for @ManyToMany uses owning entity primary table name
Summary: (6.4.0) [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.3.2
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: DR11
: EAP 6.4.0
Assignee: Gail Badner
QA Contact: Jan Martiska
URL:
Whiteboard: dev_blocker
Depends On:
Blocks: 1121629 1157597
TreeView+ depends on / blocked
 
Reported: 2014-10-17 21:57 UTC by Gail Badner
Modified: 2019-08-19 12:46 UTC (History)
5 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
: 1157597 (view as bug list)
Environment:
Last Closed:
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Gail Badner 2014-10-17 21:57:07 UTC
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:

Comment 1 Gail Badner 2014-10-17 22:21:27 UTC
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 3 Gail Badner 2014-11-21 03:09:26 UTC
Fixed for EAP 6.4.0.

Comment 4 Kabir Khan 2014-11-21 11:35:53 UTC
Fixed by Hibernate 4.2.16.Final upgrade https://bugzilla.redhat.com/show_bug.cgi?id=1121629

Comment 5 Jan Martiska 2014-11-27 12:04:32 UTC
Verified in EAP 6.4.0.DR11 / hibernate 4.2.16.Final-redhat-1.

Comment 6 Jan Martiska 2014-11-27 12:05:36 UTC
Note: the reproducer is available here: https://bugzilla.redhat.com/show_bug.cgi?id=1157597


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