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

Vermeulen commented on OPENJPA-673:
-----------------------------------

I had the same kind of exception as himakiran.

It turned out to be my own "fault": I had the version field of existing enties 
(so they already had an id) set to null in the database table.
I solved it by updating the version column to 1.

It would be nice if the exception message mentions that the problem is that a 
version is not set but an Id is so that it cannot determine if the entity is 
new or existing.

> Entity using Generated Value for primary key and a Version field and no 
> DetachedStae fails to merge 
> ----------------------------------------------------------------------------------------------------
>
>                 Key: OPENJPA-673
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-673
>             Project: OpenJPA
>          Issue Type: Bug
>            Reporter: Pinaki Poddar
>
> Entities using GeneratedValue for primary key, a version field an dno 
> detached state fails to merge.
> The issue lies with identifying :"what makes a new instance?"
> It is not obvious why VersionAttachStrategy does not use version field to 
> detect newness. Instead it depends on detached state which is obviously null 
> for instances not using a Detached State.
> Can someone shade some light on why VersionAttachStrategy ignores version 
> field to detect newness? 
>  

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

Reply via email to