Just FYI, in my quick test, if I change the line in

public void updateLockingValues(Object obj) in the ClassDescriptor class 
from 

if (fmd.isUpdateLock()) to if (fmd.isLocking())

it works the way it should.  Is this a bug?

Jay

On Thu, 26 Feb 2004 [EMAIL PROTECTED] wrote:

> What is the difference between these two methods in FieldDescriptor:
> 
> isUpdateLock()
> isLocking()
> 
> In my case, isLocking() is true.   isUpdateLock() is false.  This makes it 
> so it doesn't update the value of the column like it should.  I'm tempted 
> to patch the code and change the isUpdateLock() call to isLocking().
> 
> Jay
> 
> 
> On Thu, 26 Feb 2004, Armin Waibel wrote:
> 
> > By the way, I'm using CVS head
> > 
> > ClassDescriptor#updateLockingValues(Object obj)
> > increment version field on object
> > 
> > regards,
> > Armin
> > 
> > [EMAIL PROTECTED] wrote:
> > 
> > > I've looked through the OJB source code and can't find where it is 
> > > incrementing the version number before an update.  Can you please tell me 
> > > where that happens?
> > > 
> > > Thanks
> > > Jay
> > > 
> > > On Thu, 26 Feb 2004, Armin Waibel wrote:
> > > 
> > > 
> > >>Hi Jay,
> > >>
> > >>mapping seems ok, so it's difficult to say what's going wrong. You can 
> > >>use p6spy to log the generated SQL statements, maybe this will sheed 
> > >>some light on it.
> > >>(Or set DEBUG log level for 
> > >>org.apache.ojb.broker.accesslayer.sql.SqlGeneratorDefaultImpl
> > >>to see the generated prepared SQL statements without values).
> > >>
> > >>In OJB test suite you can find a test case for optimistic locking called 
> > >>...broker.OptimisticLockingTest (all tests pass).
> > >>
> > >>regards,
> > >>Armin
> > >>
> > >>[EMAIL PROTECTED] wrote:
> > >>
> > >>
> > >>>Hello, I can't figure out how Optimistic locking should work.  I followed 
> > >>>the instructions in the FAQ but it doesn't work.  This is the only 
> > >>>documentation I have found about Optimistic locking.  Can someone help?  
> > >>>Here is how I have things configured.
> > >>>
> > >>>I'm using rc4.
> > >>>
> > >>>Here's my table in the repository.xml file:
> > >>>
> > >>><class-descriptor class="edu.iu.uis.ps.data.ApplicationSettingsBean" 
> > >>>table="PS_APPL_STTG_T">
> > >>>  <field-descriptor name="appSettingName" column="APPL_STTG_NM" 
> > >>>jdbc-type="VARCHAR" primarykey="true" />
> > >>>  <field-descriptor name="appSettingText" column="APPL_STTG_TXT" 
> > >>>jdbc-type="VARCHAR" />
> > >>>  <field-descriptor name="ojbVerNbr" column="OJB_VER_NBR" 
> > >>>jdbc-type="BIGINT" locking="true"/>
> > >>></class-descriptor>
> > >>>
> > >>>(note the locking="true" on ojbVerNbr)
> > >>>
> > >>>The table doesn't allow null values in ojb_ver_nbr.  If I try to insert a 
> > >>>row and don't set ojb_ver_nbr, I get an exception because ojb_ver_nbr 
> > >>>isn't set.
> > >>>
> > >>>If I try to simulate a situation where optimistic locking is necessary, it 
> > >>>doesn't work.  The value of ojb_ver_nbr never changes and it doesn't 
> > >>>detect situations that it should.  Here is sample code:
> > >>>
> > >>>    ApplicationSettingsBean as = new ApplicationSettingsBean();
> > >>>    as.setAppSettingName("junk");
> > >>>    as.setAppSettingText("Value 1");
> > >>>    as.setOjbVerNbr(new Long(1));
> > >>>    as.store(broker);
> > >>>    System.err.println("Stored");
> > >>>
> > >>>    ApplicationSettingsBean as1 = new ApplicationSettingsBean();
> > >>>    as1.setAppSettingName("junk");
> > >>>    as1.setAppSettingText("Value 2");
> > >>>    as1.setOjbVerNbr(new Long(1));
> > >>>
> > >>>    ApplicationSettingsBean as2 = new ApplicationSettingsBean();
> > >>>    as2.setAppSettingName("junk");
> > >>>    as2.setAppSettingText("Value 3");
> > >>>    as2.setOjbVerNbr(new Long(1));
> > >>>
> > >>>
> > >>>    as1.store();
> > >>>    System.err.println("2nd Stored");
> > >>>
> > >>>    // This should fail
> > >>>    as2.store();
> > >>>    System.err.println("3rd Stored");
> > >>>
> > >>>The 3rd store should fail because it tried to write on top of the 2nd 
> > >>>store.  It succeeds and the ojb_ver_nbr column never changes.
> > >>>
> > >>>Can someone please tell me how to get this to work?
> > >>>
> > >>>Thanks
> > >>>Jay
> > >>>
> > >>>
> > >>>
> > >>>
> > >>>---------------------------------------------------------------------
> > >>>To unsubscribe, e-mail: [EMAIL PROTECTED]
> > >>>For additional commands, e-mail: [EMAIL PROTECTED]
> > >>>
> > >>>
> > >>>
> > >>
> > >>---------------------------------------------------------------------
> > >>To unsubscribe, e-mail: [EMAIL PROTECTED]
> > >>For additional commands, e-mail: [EMAIL PROTECTED]
> > >>
> > > 
> > > 
> > > 
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > > For additional commands, e-mail: [EMAIL PROTECTED]
> > > 
> > > 
> > > 
> > 
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> > 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to