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] Resolved: (OPENJPA-578) Specifying a default for VersionStrategy in persistence.xml has no effect when a version field is present in the entity class.
Date Mon, 21 Apr 2008 22:41:21 GMT

     [ https://issues.apache.org/jira/browse/OPENJPA-578?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Fay Wang resolved OPENJPA-578.
------------------------------

    Resolution: Fixed

We found a workaround to overwrite the current behavior without any openjpa change.

> Specifying a default for VersionStrategy in persistence.xml has no effect when a version
field is present in the entity class.
> ------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: OPENJPA-578
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-578
>             Project: OpenJPA
>          Issue Type: Improvement
>          Components: jdbc
>    Affects Versions: 1.0.2
>            Reporter: Fay Wang
>             Fix For: 1.2.0
>
>         Attachments: openjpa.patch
>
>
> Specifying a default for VersionStrategy in persistence.xml has no effect when a version
field is present in the entity class.
> According the OpenJPA documentation the following property should override the default
value of VersionStrategy and the specified RowChangeTimestampStrategy should be applied for
all entity classes. 
>  <property name="openjpa.jdbc.MappingDefaults" 
>   	        value="jpa(VersionStrategy=com.ibm.websphere.persistence.RowChangeTimestampStrategy)"
/>
> JPA accepts this property but then it has no effect on Entity mappings if the version
field is present.
> import javax.persistence.*;
> import org.apache.openjpa.persistence.jdbc.VersionStrategy;
> @Entity
> public class EntityA {
> 	@Id int id;
> 	String name;
> 	double amt;
> 	@Version java.sql.Timestamp lastUpdate;
> For EntityA, the version strategy should be RowChangeTimestampStrategy. Instead, the
NumberVersionStrategy is adopted. 
> If the @Version is removed from EntityA, the version strategy becomes RowChangeTimestampStrategy.

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