Title: RE: [castor-dev] [JDO] bug 1107 Timestamp mismatched exception when using longtransaction
I haven't implemented this but was thinking I might try it. Anyone think it would help?
 
All the getKey methods in your castor classes should have a corresponding getKeyLongTx that returns the actual key value concatenated with the jdoTimestamp. The corresponding setKeyLongTx would split the values and store them appropriatly back into the original object.
 
class Person implements TimeStampable
{
    private long m_timeStamp = 0;
    private long int m_key;

    public String getPrimaryKeyLongTx()
    {
        StringBuffer primaryKeyLongTx =
new StringBuffer();
        primaryKeyLongTx.append(String.valueOf(jdoGetTimeStamp()));
        primaryKeyLongTx.append(
"|");
        primaryKeyLongTx.append(String.valueOf(getPrimaryKey()));
       
return primaryKeyLongTx.toString();
    }

    public void setPrimaryKeyLongTx(String a_primaryKeyLongTx)
    {
       
int barPos = a_primaryKeyLongTx.indexOf('|');
        String timestamp = a_primaryKeyLongTx.substring(0, barPos);
        String primaryKey = a_primaryKeyLongTx.substring(barPos + 1);
        jdoSetTimeStamp(Integer.parseInt(timestamp));
        setPrimaryKey(Integer.parseInt(primaryKey));
    }

    public void jdoSetTimeStamp(long a_timeStamp)
    {
        m_timeStamp = a_timeStamp;
    }

    
public long jdoGetTimeStamp()
    {
        
return m_timeStamp;
    }

    public
int getPrimaryKey()
    {
        
return m_key;
    }

    
public void setPrimaryKey(int a_key)
    {
        m_key = a_key);
    }
}

Ed.

Reply via email to