I take it that if you close the app, and load it again then the task appears?
If so, i'd guess it's down to caching. I had this problem, although i'd assumed that this was a 'feature'. After each insert do: PersistenceBroker broker = PersistenceBrokerFactory.defaultPersistenceBroker(); broker.clearCache(); And the next query should find all the tasks. Daniel. -----Original Message----- From: news [mailto:[EMAIL PROTECTED] Behalf Of Wil Hunt Sent: 14 April 2004 17:55 To: [EMAIL PROTECTED] Subject: Re: ODMG API Question After going home last night and thinking about this over a beer, I realized that either I was high yesterday, or my brain ceased to function properly. The description I gave was not an accurate portrayal of the problem at hand. (Though it would have had similar results if I HAD had the problem.) Here's what was REALLY going on... (<bonk self>) I have two classes Summary and Task. There is a foreign-key relationship from Task to Summary such that there are 0..n tasks for each summary and one summary per task. In the repository.xml I had told OJB to make a collection of Tasks per Summary using the inverse foreign-key relationships. Step one: Get Summary by primary key. -- No problem. Step two: Get taskList by calling collection on returned summary. -- No problem. Step three: Create new Task that points to the same summary -- k.. it's in the DB Step four: Get same summary by primary key -- k... Step five: Get taskList by calling collection on returned summary. This is where I get the same list I got in step two. I apologize for the confusion. I'm using ODMG calls to read/write my db. I have temporarily side-stepped this issue by simply removing the collection/inverse foreign key lookup and doing a manual getTasksBySummaryId lookup instead. I would still love to know how to get the above scenario to work. I have a feeling that auto-update="object" or something might affect this, but I remember reading that when using ODMG, you're supposed to leave those settings at the defaults. Thanks! Wil "Brian McCallister" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Odd. Some notes... > > Task.getClass().getName() works better as Class#toString isn't the > class name =( > > Do you not get ANY objects back, or do you get a different object back > form the query? > > Is the foreign key a primitive type by chance? > > -Brian > > On Apr 13, 2004, at 8:20 PM, Wil Hunt wrote: > > > Hey guys, > > > > I'm having a problem with regard to OJB-managed objects and their > > visibility. Here's the scenario: > > > > 1) Create a new object: > > Task task = new Task(...); > > Transaction tx = _odmg.newTransaction(); > > tx.begin(); > > tx.lock(task, Transaction.WRITE); > > tx.commit(); > > > > Note: task is saved (successfully) with a foreign key X. > > > > If I check the database.. the object is there. Good. > > 2) Query ODMG: > > select tasks from Task.getClass() where fkeyname = X > > > > This request does not return the above mentioned objects. > > > > If I restart my server (thus restarting OJB) then the objects show up > > in > > further queries. > > > > am I missing something obvious? > > > > Any assistance would be greatly appreciated. > > > > Thanks! > > > > Wil > > > > > > > > > > --------------------------------------------------------------------- > > 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]