[ 
https://issues.apache.org/jira/browse/OPENJPA-2979?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18115270#comment-18115270
 ] 

ASF subversion and git services commented on OPENJPA-2979:
----------------------------------------------------------

Commit b5e6d26c07dbbdf728f80d6491333c6cc668b7bf in openjpa's branch 
refs/heads/OPENJPA-2979 from Richard Zowalla
[ https://gitbox.apache.org/repos/asf?p=openjpa.git;h=b5e6d26c0 ]

[OPENJPA-2979] Support composite ids in getReference(entity)

Derive the object id from the instance's state manager or its primary
key fields instead of reading a single id field, resolve metadata for
generated subclasses and fail with a clear message when no id is set.


> 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
>            Priority: Major
>             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