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

Fay Wang commented on OPENJPA-1720:
-----------------------------------

Hi Howard, 
OpenJPA seems inconsistent in handling the version field when inheritance is 
involved. In some situations, the following error message is thrown from 
ColumnVersionStrategy:

not-base-vers: Type "{0}" specifies a version strategy, but has a mapped \
        persistence capable superclass or is embedded.  Subclasses and embedded 
\
        values must use the version strategy of the base or embedding class.

In other situations (the one reported in this JIRA and 
org.apache.openjpa.persistence.inheritance.TestDefaultInheritanceStrategy), 
this error condition is not detected. These test cases have one thing in 
common: the parent class does not have version field, while the child class 
has.  In this scenarios, the version column is not created in the child table 
nor in the parent table, and the version field is totally ignored by the 
OpenJPA. The attached patch attempts to detect the error condition and issues 
the error message if the condition is found true. However, this breaks the test 
case (mentioned above) of the OpenJPA regression bucket and may potentially 
break existing applications. Adding independent version support for child only, 
on the other hand, will have bigger impact and is not compatible with the 
current OpenJPA version handling. 
   Weighing the pros and cons, the better approach to this problem seems to 
move the version field from the child to the parent to gain full version 
support from OpenJPA. Please let me know what you think. 








> MappingTool does not add version column for subclass
> ----------------------------------------------------
>
>                 Key: OPENJPA-1720
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-1720
>             Project: OpenJPA
>          Issue Type: Bug
>    Affects Versions: 2.0.0
>            Reporter: Howard
>            Assignee: Fay Wang
>         Attachments: jpa_test.zip, OPENJPA-1720.patch
>
>
> MappingTool does not add version column for subclass

-- 
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