After inserting in this way, if you want to see the new object in a
collection (like the DG), you should fetch the DG's contents again
BEFORE the pages is returned. However a better way that avoid the I/O
is to have the DG do the insert, that way you create a new object,
insert it into the EC, AND update the collection's contents in one shot.
d
Matthew Bickham wrote:
>
> Hi,
>
> I have an WO application where I am inserting Enterprise Objects (with a
> Sybase db), saving the changes to the database, and then displaying all
> of the objects using a displaygroups AllObjects method.
>
> e.g.
> // insert new object
> public WOComponent addNewType() {
> itlComponentType newCT = new itlComponentType(null, null, null)
> //create a new EO
> this.session().defaultEditingContext().insertObject(newCT); //
> insert the object
> newCT.setTypeName(newTypeName);
> this.session().defaultEditingContext().saveChanges(); //commit
> changes
>
> return null
> }
>
> Then at the awake of the component, I call the fetch() method of the
> displayGroup which should display all of the objects (including the
> newly inserted one). However, when the new page is displayed, the newly
> inserted object is not displayed - but when I insert another object, the
> older object is then displayed in the list.
>
> There seems to be a delay between when an object is inserted and when it
> appears in a fetch. Therefore should a fetch display objects which are
> in the object graph but not yet commited to the database? Also as I have
> saved the changes, should I expect a delay between when the save has
> been sent to the database and when the record is then included in a
> fetch from the database?
>
> Thanks,
>
> Matthew Bickham
>
> --
> --------------------------------------------------------
> | Matthew Bickham The University Of Sydney |
> | Computer Systems Officer NSW 2006 Australia |
> | Arts-IT Unit Ph: +61 (2) 9351 7513 |
> | mobile: 0414 791069 |
> | |
> | email: [EMAIL PROTECTED] |
> --------------------------------------------------------