Persisting partially-generated composite Ids fails with HibernateException: No part of a composite identifier may be null
Description
caused by
is followed up by
Activity
![](https://secure.gravatar.com/avatar/1cd2025cca6a5a953a0ed8a1275cf96e?d=https%3A%2F%2Favatar-management--avatars.us-west-2.prod.public.atl-paas.net%2Finitials%2FIS-3.png)
IT Support April 23, 2020 at 2:17 AM
back-ported 5.2.x pull request
![](https://secure.gravatar.com/avatar/1cd2025cca6a5a953a0ed8a1275cf96e?d=https%3A%2F%2Favatar-management--avatars.us-west-2.prod.public.atl-paas.net%2Finitials%2FIS-3.png)
IT Support April 22, 2020 at 11:29 PM
pull request
![](https://secure.gravatar.com/avatar/1cd2025cca6a5a953a0ed8a1275cf96e?d=https%3A%2F%2Favatar-management--avatars.us-west-2.prod.public.atl-paas.net%2Finitials%2FIS-3.png)
IT Support April 22, 2020 at 6:26 PM
Tracked this down, it was caused by HHH-4848 on Wed Feb 3 06:58:46 2010 +0000
see:
The check used to skip null values with a continue, but was changed to throw an exception. As such HHH-10956 is a regression caused by HHH-4848
This is the (relevant) commit log for the offending file
commit 3906816ee2625987796feb587ca374a55c3374ae
Author: Steve Ebersole steve@hibernate.org
Date: Mon Dec 19 16:35:48 2016 -0600HHH-11274 - EntityManagerFactoryImpl.getIdentifier uses deprecated version of getIdentifier
commit 87e3f0fd28d7229b0a35032292ff32f542c22010
Author: Steve Ebersole steve@hibernate.org
Date: Tue Apr 19 13:14:02 2016 -0500HHH-10664 - Prep 6.0 feature branch - merge hibernate-entitymanager into hibernate-core (first sucessful full compile of consolidated hibernate-core)
commit 611f8a0e1c3764dc4505a32294ff0fbeaa8d2e6b
Author: Steve Ebersole steve@hibernate.org
Date: Mon May 18 13:35:26 2015 -0500HHH-9803 - Checkstyle fix ups
commit 8fe5460ec03942e974d4aae7d9060e20bab7f990
Author: Steve Ebersole steve@hibernate.org
Date: Sun Nov 24 20:07:37 2013 -0600HHH-8741 - More checkstyle cleanups
commit 19791a6c7d17f6f5d74dd9b42bdb4fcb7f5a9be1
Author: Steve Ebersole steve@hibernate.org
Date: Fri Mar 18 15:51:43 2011 -0500HHH-6026 - Migrate bytecode provider integrations to api/spi/internal split
commit 839e23458aa0c50e1dc0d8f1a1bed87dbff49f3b
Author: Steve Ebersole steve@hibernate.org
Date: Mon Feb 8 19:27:00 2010 +0000HHH-4704 - Pass session into EntityTuplizer#setIdentifier
git-svn-id: https://svn.jboss.org/repos/hibernate/core/trunk@18733 1b8cb986-b30d-0410-93ca-fae66ebed9b2
commit 53b1890c1b2b43a8dc89f0f09d6d3b6b6f3cbdc1
Author: Steve Ebersole steve@hibernate.org
Date: Fri Feb 5 02:42:55 2010 +0000HHH-4848 - Derived identities: Derived entities using @IdClass and mapping a @XToOne are not supported
git-svn-id: https://svn.jboss.org/repos/hibernate/core/trunk@18698 1b8cb986-b30d-0410-93ca-fae66ebed9b2
![](https://secure.gravatar.com/avatar/ab9016b42209c955125d80ec5ef1345f?d=https%3A%2F%2Favatar-management--avatars.us-west-2.prod.public.atl-paas.net%2Finitials%2FVD-2.png)
V. Dubus December 6, 2018 at 10:50 AM
Quick sample project to show case the bug with a composite key and a part of it should be generated.
Was test using the latest version of Hibernate 5.4.0.CR2.
Changing the @GeneratedValue from SEQUENCE to IDENDITY still make the same error.
![](https://secure.gravatar.com/avatar/ab9016b42209c955125d80ec5ef1345f?d=https%3A%2F%2Favatar-management--avatars.us-west-2.prod.public.atl-paas.net%2Finitials%2FVD-2.png)
V. Dubus December 5, 2018 at 11:02 AMEdited
This bug still exist in version 5.2.17.
I have the same error with HSQLDB when running my tests.
The ID is generated using a SEQUENCE.
Suppose we have following entities:
Persisting these fails with: