Bug 1154212

Summary: (6.4.0) [HHH-9390] Default join column name (FK) for @ManyToMany uses owning entity primary table name
Product: [JBoss] JBoss Enterprise Application Platform 6 Reporter: Gail Badner <gbadner>
Component: HibernateAssignee: Gail Badner <gbadner>
Status: CLOSED CURRENTRELEASE QA Contact: Jan Martiska <jmartisk>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 6.3.2CC: cdewolf, jmartisk, kkhan, msimka, smarlow
Target Milestone: DR11   
Target Release: EAP 6.4.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard: dev_blocker
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
: 1157597 (view as bug list) Environment:
Last Closed: Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1121629, 1157597    

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