Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.

Bug 1265256

Summary: [GSS](6.4.z) HHH-5764 - AssertionFailure: Unexpected nested component on the referenced entity when mapping a @MapsId
Product: [JBoss] JBoss Enterprise Application Platform 6 Reporter: Gary Hu <ghu>
Component: HibernateAssignee: Gail Badner <gbadner>
Status: CLOSED CURRENTRELEASE QA Contact: Martin Simka <msimka>
Severity: high Docs Contact:
Priority: high    
Version: 6.4.4CC: andey, bmaxwell, gbadner, istudens, jmartisk, msimka, sfikes, smarlow
Target Milestone: CR1   
Target Release: EAP 6.4.6   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2017-01-17 11:49:02 UTC 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: 1235746, 1286824    
Attachments:
Description Flags
hibernate4.01491237.HHH-5764.tar.gz none

Description Gary Hu 2015-09-22 13:25:12 UTC
Created attachment 1075834 [details]
hibernate4.01491237.HHH-5764.tar.gz

When the composite primary key references more than 2 levels, it fails with the error "org.hibernate.AssertionFailure: Unexpected nested component on the referenced entity when mapping a @MapsId: xxx".

For example:
@Entity
@IdClass(Level1EntityPK.class)
public class Level1Entity {

    @Id
    @ManyToOne
    private Level2Entity level2Entity;
    ...
}

@Entity
@IdClass(Level2EntityPK.class)
public class Level2Entity {
    @Id
    @ManyToOne
    private Level3Entity level3Entity;
    
    ...
}

@Entity
@IdClass(Level3EntityPK.class)
public class Level3Entity {

    @Id
    @Column(name = "LEVEL3_ENTITY_NO")
    private String level3EntityNo;
   
    ...
}

A jira https://hibernate.atlassian.net/browse/HHH-5764 has already been raised.

Comment 1 Gary Hu 2015-09-22 13:28:41 UTC
I have attached a simple test project that could reproduce the issue.

To run the test project:

1) edit the src/test/resources/META-INF/persistence.xml to use your own database connection properties(url, username, password, etc.)

2) type mvn clean package

Comment 3 Gail Badner 2015-10-29 23:05:00 UTC
Final touches are being made to upstream pull request. This should make it into EAP 6.4.6 if approved.

Comment 6 Jan Martiska 2016-01-20 08:37:51 UTC
Verified with EAP 6.4.6.CR2

Comment 7 Petr Penicka 2017-01-17 11:49:02 UTC
Retroactively bulk-closing issues from released EAP 6.4 cumulative patches.