I'll grant that it probably isn't a caching issue. Here's the field-descriptor from our repository:
<field-descriptor name="assignedDC" column="Assigned_DC" jdbc-type="INTEGER"/> Full class-descriptor follows (by the way, kudos for creating a framework that is capable of materializing such complex objects): <class-descriptor class="com.xxx.idma.data.CollectionItem" table="Data_Collection"> <field-descriptor name="id" column="Data_Collection_ID" jdbc-type="INTEGER" primarykey="true" autoincrement="true"/> <field-descriptor name="versionId" column="Version_ID" jdbc-type="INTEGER" primarykey="true"/> <field-descriptor name="approvedDate" column="Approved_Date" jdbc-type="TIMESTAMP"/> <field-descriptor name="approvedUserId" column="Approved_User_ID" jdbc-type="INTEGER"/> <field-descriptor name="itemId" column="Item_ID" jdbc-type="INTEGER"/> <field-descriptor name="requestedDate" column="Requested_Date" jdbc-type="TIMESTAMP"/> <field-descriptor name="requestedUserId" column="Requested_User_ID" jdbc-type="INTEGER"/> <field-descriptor name="validatedDate" column="Validated_Date" jdbc-type="TIMESTAMP"/> <field-descriptor name="validatedUserId" column="Validated_User_ID" jdbc-type="INTEGER"/> <field-descriptor name="state" column="State" jdbc-type="CHAR"/> <field-descriptor name="assignedDC" column="Assigned_DC" jdbc-type="INTEGER"/> <field-descriptor name="mfrCode" column="Mfr_Code" jdbc-type="CHAR"/> <field-descriptor name="skuCode" column="Sku_Code" jdbc-type="VARCHAR"/> <reference-descriptor name="itemLocation" class-ref="com.xxx.idma.data.ItemLocation"> <foreignkey field-ref="versionId"/> <foreignkey field-ref="itemId"/> <foreignkey field-ref="assignedDC"/> </reference-descriptor> <collection-descriptor name="commentList" element-class-ref="com.xxx.idma.data.Comment" orderBy="commentDate" sort="DESC"> <inverse-foreignkey field-ref="dataCollectionId"/> <inverse-foreignkey field-ref="versionId"/> </collection-descriptor> <collection-descriptor name="uomList" element-class-ref="com.xxx.idma.data.CollectionUOM" orderBy="level" sort="ASC"> <inverse-foreignkey field-ref="dataCollectionId"/> <inverse-foreignkey field-ref="versionId"/> </collection-descriptor> <collection-descriptor name="merchandisingUOMList" element-class-ref="com.xxx.idma.data.MerchandisingUOM"> <query-customizer class="com.xxx.idma.data.service.CollectionItemMerchUOMQueryCustomizer"/> </collection-descriptor> </class-descriptor> -----Original Message----- From: Thomas Mahler [mailto:[EMAIL PROTECTED] Sent: Thursday, June 19, 2003 1:33 PM To: OJB Users List Subject: Re: Caching/store bug? IMO this has nothing to do with caching. the store method itself seems to modify the instance without any interference of the cache. Maybe you have defined autoincrement="true" for the assigneDC attribute? Or did you set locking="true" on this field? cheers, Thomas Rob Kischuk wrote: > > > I'm using OJB 1.0rc3, and running into a rather vexing caching issue - I'm > hoping someone else can shed some light on the issue. I'm executing the > following code: > > > > CollectionItemService service = CollectionItemService.getInstance(); > > CollectionItem item = service.findById( collectionItemId ); > > item.setAssignedDC( 0 ); > > item.setState( CollectionItem.STATE_UNASSIGNED ); > > log.info("*** Collection item has ID " + item.getId() ); > > log.info("*** Assigned DC is " + item.getAssignedDC() ); > > service.clearCache(); > > service.store( item ); > > log.info("*** Collection item has ID " + item.getId() ); > > log.info("*** Assigned DC is " + item.getAssignedDC() ); > > > > and the service methods look like this: > > > > protected CollectionItemService() > > { > > broker = PersistenceBrokerFactory.defaultPersistenceBroker(); > > } > > > > public static CollectionItemService getInstance() > > { > > return new CollectionItemService(); > > } > > > > public void store( CollectionItem c ) { > > broker.beginTransaction(); > > broker.store( c ); > > broker.commitTransaction(); > > broker.close(); > > } > > > > public CollectionItem findById( String collectionItemId ) > > { > > Criteria crit = new Criteria(); > > crit.addEqualTo("id", collectionItemId); > > Query query = new QueryByCriteria( CollectionItem.class, crit ); > > return (CollectionItem) broker.getObjectByQuery( query ); > > } > > > > The debug statements before I call store output: > > *** Collection item has ID 1 > > *** Assigned DC is 0 > > > > and after store, the output is: > > > > *** Collection item has ID 1 > > *** Assigned DC is 1 (This was the value prior to setAssignedDC) > > > > I find it rather vexing that somehow, the broker.store() seems to be > changing the state of the object I am storing. I see the parameterized > update statement being properly generated by the SqlGenerator, but the > database is also not being properly updated. Can anyone shed some light on > this problem? > > > > -Rob > > --------------------------------------------------------------------- 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]