Maxim Solodovnik created OPENJPA-2979:
-----------------------------------------

             Summary: getReference(entity) fails on composite ids
                 Key: OPENJPA-2979
                 URL: https://issues.apache.org/jira/browse/OPENJPA-2979
             Project: OpenJPA
          Issue Type: Sub-task
          Components: jpa
    Affects Versions: 4.2.0
            Reporter: Maxim Solodovnik
             Fix For: 4.2.0


Discussion thread: 
https://github.com/apache/openjpa/pull/144#discussion_r3683004886


**(medium)** `getReference(T entity)` only extracts the PK when 
`pkFields.length == 1`; for composite/IdClass/EmbeddedId entities `pk` stays 
null and the call fails downstream with a misleading "null pk" 
IllegalArgumentException. Also `entity.getClass()` (line 2657) may be a runtime 
subclass without direct metadata. Could composite ids be supported via 
`broker.getObjectId`, or at least fail with an explicit "composite id not 
supported" message?



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to