openjpa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Fay Wang (JIRA)" <j...@apache.org>
Subject [jira] Commented: (OPENJPA-1371) Insert is called instead of Update when merge() with derived Identity
Date Sun, 01 Nov 2009 00:43:59 GMT

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

Fay Wang commented on OPENJPA-1371:
-----------------------------------

During merge, openjpa needs to retrieve id from the entity to decide whether this is a new
entity or a detached one. If it thinks it is a new entity, an INSERT will be perform. Otherwise,
an Update statement will be executed. 
If  (1) an entity has the compound primary key using IdClass, and 
    (2) some field in the IdClass is a derived identity from a OneToOne/ManyToOne field,
    (3) that value in that field has not yet become managed (i.e., does not have the StateManagerImpl
yet),
this field in the IdClass will not be populated, as the primary key of the OneToOne/ManyToOne
field usually can not be fetched back without an associated StateManagerImpl, unless it has
a single-value primary key. 

Currently openjpa returns the null value for this field in the IdClass regardlessly in the
above situation.  The patch provides a relief when this derived identity-relation field has
a single value primary key. It should fix the problem reported by Constantine. However, the
limitation for nested/multi-level compound primary (e.g. Stock entity has compound primary
key using IdClass, and some value in the idClass is a derived-identity relation field, ...)
during merge remains.   


> Insert is called instead of Update when merge() with derived Identity
> ---------------------------------------------------------------------
>
>                 Key: OPENJPA-1371
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-1371
>             Project: OpenJPA
>          Issue Type: Bug
>          Components: kernel
>    Affects Versions: 2.0.0-M3
>            Reporter: Fay Wang
>             Fix For: 2.0.0-M3
>
>
> Insert is called instead of Update when merge() with derived Identity:

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message