I have a composite key which consists of two parts
Account_id
id
Id column is generated using strategy GenerationType.IDENTITY. When we create a new object and save using entitymanager, after save the object does not have the generated id back.
CompositeKey key = new CompositeKey();
key.setAccountId(1L);
SalesContact contact = new SalesContact();
contact.setFirstName("John");
contact.setKey(key);
entityManager.persist( contact );
Assertions.assertNotNull(key.getId());