Fast Object Database for Java - with JPA/JDO support

Entity field renaming does not work

#1

Hello,

we use the ObjectDB version 2.8.5_05.

We want to rename a field in an entity and it does not work:

from:

package com.btc.ep.analysis.verdict.tolerance.bl.internal.dmos;

@Entity

@Access (AccessType.FIELD)
public class ToleranceDeviationImpl {
    @Basic
    private String referenceDatatype;
    @Basic
    private String comparisonDatatype;
}

to:

    @Basic
    private String referenceDisplayDataTypeName;
    @Basic
    private String comparisonDisplayDataTypeName;

We added the schema for renaming to the objectdb config:

 

    <schema>
        <package name="com.btc.ep.atg4struct.bl.internal.dmos">
            <class name="CoveragePropertyToBoolObserverImpl" new-name="com.btc.ep.atg4struct.internal.dmos.CoveragePropertyToBoolObserverImpl" />
        </package>
        <package name="com.btc.ep.formalverification.al.enums">
            <class name="ResultExpectationEnum" new-name="com.btc.ep.formalverification.enums.ResultExpectationEnum" />
        </package>
        <package name="com.btc.ep.formalverification.bl.dmos">
            <class name="ProofResult" new-name="com.btc.ep.formalverification.internal.dmos.ProofResult" />
            <class name="ProofResult$Result" new-name="com.btc.ep.formalverification.internal.dmos.ProofResult$Result" />
            <class name="ProofResult$TerminationReason" new-name="com.btc.ep.formalverification.internal.dmos.ProofResult$TerminationReason" />
        </package>                           
        <package name="com.btc.ep.formalverification.bl.internal.dmos">
            <class name="ProofSettingsImpl" new-name="com.btc.ep.formalverification.internal.dmos.ProofSettingsImpl" />                      
            <class name="ProofResultImpl" new-name="com.btc.ep.formalverification.internal.dmos.ProofResultImpl" />
            <class name="ProofImpl" new-name="com.btc.ep.formalverification.internal.dmos.ProofImpl" />
        </package> 
        <package name="com.btc.ep.analysis.verdict.tolerance.bl.internal.dmos">
            <class name="ToleranceDeviationImpl">
                <field name="referenceDatatype" new-name="referenceDisplayDataTypeName" />
                <field name="comparisonDatatype" new-name="comparisonDisplayDataTypeName" />
            </class>
        </package>
    </schema>

 

We have also class and package renaming for other entities and it works correctly.

#2

Thank you for this report, we are investigating the issue.

ObjectDB Support
ObjectDB - Fast Object Database for Java (JPA/JDO)
#3

Unfortunately we cannot reproduce the issue, as we checked and this feature seems to work well in our small tests (and also the relevant code in ObjectDB has not been changed recently).

Please note that supporting field renaming is very sensitive. There is nothing wrong with your code or configuration as posted above. However, for this to work the timing is very important. On the first time that the database is opened with the schema change specified in the configuration file, only the class after the change has to be available on the classpath. Otherwise the upgrade will fail. Could you please confirm that this is the case?

As we cannot reproduce the issue, to explore it further we will need your help. Could you please post (possibly in a private support ticket) a sample test database before the schema change, up to date classes (no source code is needed) with the new field names and your ObjectDB configuration file?

ObjectDB Support
ObjectDB - Fast Object Database for Java (JPA/JDO)

Post Reply