Re: I know this must be a FAQ, but...



> > I've been trying to do EJB-style CORBA: i.e. there's only one object for
> > each 'entity' in the program, obtained through a 'find' request on a
> > factory. The factory uses a GHashtable to store object references, but I
> > know this isn't right, because when an object reference is returned by the
> > find() function, it is released by the skeleton.
> 
> 	Take a look at CORBA_Object_hash - I think that's what you're
> looking for..

I'm not sure it is.. I think that would be for using a CORBA_Object as the
key into a hashtable, which is not what I want.

If I have, say, a User (CORBA_Object) with a 'primary key' of "fred" (i.e.
a user record for a user called "fred"), then I want to be able to
retrieve a reference to the SAME object, no matter how many times I call
UserFactory_find("fred"). To that end, I was originally storing an object
reference to the User in a GHashtable, keyed by the string "fred", then
returning that object reference on all calls to find("fred"). But that's
no good, because when you return the object reference it gets released by
the skeleton (as ownership passes to the client) and then the next time
you return it an error occurs. So my problem really is what to store in
the hashtable and how to return it, not how to key it.

Hope this clarifies things,
Gareth





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]