You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ojb-user@db.apache.org by Ryan <ry...@ryanharris.us> on 2005/09/16 20:37:58 UTC

re optimistic locking with multiple joined table

I had a mis-typed field name in my repository_user.xml that was causing
an optimistic locking exception when batch-mode was turned on in my
database connection descriptor.  Please disregard the last email, I was
misdirected by the error message. The configuration below seems to work
okay now...






Hello,

        How do I set up optimistic locking when I am mapping classes on
multiple joined tables?  The documentation examples on multiple joined
fields, use a class B that extends class A. I'm not sure if the
version_maintained_by_ojb should be mapped to a field in the table for
the super class A or the table for class B or both.  If on both tables
do the mutators need to be named differently?  Should the values be kept
synchronized?  I'm confused and am getting optimistic locking exceptions
spuriously.

Thanks For Any Guidance.  :)

Ryan Harris.



public class A
{
    // primary key
    int id;
    // mapped to a column in A_TABLE
    int someValueFromA;

    //mapped to a column in A_TABLE
        Integer versionMaintainedByOjb;
}

public class B extends A
{
    // id is primary key and serves also as foreign key referencing A.id
    int id;
    // mapped to a column in B_TABLE
    int someValueFromB;
         
   // mapped to a column in B_TABLE
        Integer versionMaintainedByOjb;
}


I currently have both set with the same name, but have been noticing
that when I get and then update a super class (class A), the version
increments on the A class as expected. But when I open a B class that
extends the same A-class,  the version on the B class table no longer
matches the version on the A class.  


---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org