[
https://issues.apache.org/jira/browse/OPENJPA-1632?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12858230#action_12858230
]
Fay Wang commented on OPENJPA-1632:
-----------------------------------
An alternative to the orm approach is to write a custom MappingDefaults:
package org.spec.jent;;
import java.util.ArrayList;
import java.util.List;
import org.apache.openjpa.jdbc.meta.Version;
import org.apache.openjpa.jdbc.schema.Column;
import org.apache.openjpa.persistence.jdbc.PersistenceMappingDefaults;
import com.ibm.websphere.persistence.RowChangeTimestampStrategy;
public class MappingDefaults extends PersistenceMappingDefaults{
@Override
public Object getStrategy(Version vers, boolean adapt) {
String verColName = "Ver_Col";
List<Column> cols = new ArrayList<Column>();
Column verCol = new Column();
verCol.setName(verColName);
cols.add(verCol);
vers.getMappingInfo().setColumns(cols);
return new RowChangeTimestampStrategy();
}
}
and add <property name="openjpa.jdbc.MappingDefaults"
value="org.spec.jent.MappingDefaults" /> to the persistence.xml.
In so doing, the source code does not need to be re-compiled.
> Add @VersionColumn and @VersionStrategy to orm.xml
> --------------------------------------------------
>
> Key: OPENJPA-1632
> URL: https://issues.apache.org/jira/browse/OPENJPA-1632
> Project: OpenJPA
> Issue Type: Improvement
> Affects Versions: 2.1.0
> Reporter: Fay Wang
> Assignee: Fay Wang
> Attachments: OPENJPA-1632.patch
>
>
> Add support of @VersionColumn and @VersionStrategy to orm.xml:
> <entity class="dbgenvsn.EntityA" >
> <version-strategy
> name="com.ibm.websphere.persistence.RowChangeTimestampStrategy" />
> <version-column name="versionColumn" />
> </entity>
> so that the source EntityA does not need to recompile to enable a particular
> version strategy.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
https://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira