Bug 1265256 - [GSS](6.4.z) HHH-5764 - AssertionFailure: Unexpected nested component on the referenced entity when mapping a @MapsId
[GSS](6.4.z) HHH-5764 - AssertionFailure: Unexpected nested component on the ...
Status: CLOSED CURRENTRELEASE
Product: JBoss Enterprise Application Platform 6
Classification: JBoss
Component: Hibernate (Show other bugs)
6.4.4
Unspecified Unspecified
high Severity high
: CR1
: EAP 6.4.6
Assigned To: Gail Badner
Martin Simka
:
Depends On:
Blocks: 1235746 1286824
  Show dependency treegraph
 
Reported: 2015-09-22 09:25 EDT by Gary Hu
Modified: 2017-01-17 06:49 EST (History)
8 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2017-01-17 06:49:02 EST
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
hibernate4.01491237.HHH-5764.tar.gz (38.74 KB, application/x-gzip)
2015-09-22 09:25 EDT, Gary Hu
no flags Details


External Trackers
Tracker ID Priority Status Summary Last Updated
Red Hat Knowledge Base (Solution) 2143451 None None None 2016-01-28 09:54 EST

  None (edit)
Description Gary Hu 2015-09-22 09:25:12 EDT
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 09:28:41 EDT
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 19:05:00 EDT
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 03:37:51 EST
Verified with EAP 6.4.6.CR2
Comment 7 Petr Penicka 2017-01-17 06:49:02 EST
Retroactively bulk-closing issues from released EAP 6.4 cumulative patches.

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