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

Re: Object Creation in ozone



On Fri, 11 Aug 2000, Don Berendsen wrote:
> Hi Falko,
> 
> > > The sample code is below. I don't fully understand the implications of 
> >your
> > > statement 'Setting a static member of Repository that holds the client's
> > > database object will not work because...'.
> >
> >Your Local class represents/starts/is the client application. In the main()
> >method of Local the static member db of the Repository class is 
> >initialized. In
> >the next lines of the main method this static db member is used to access 
> >the
> >database. This is okay so far. But, when calling createObject() the
> >corresponding object is created inside the server. While creating this 
> >object
> >its ctor is called. Again, this happens inside the server! The static db 
> >member
> >of Repository isn't initialized here because it's a different class inside 
> >a
> >different VM.
> >
> >In your particular case you are using a LocalDatabase to access the 
> >database.
> >This means that both, client and server, running inside the same VM. 
> >Therefore
> >the static db member of Repository in fact is initialized but this member 
> >cannot
> >be used inside database object however.
> >
> > >
> > > Once a database is opened what are the proper ways to get or pass a
> > > reference to it for objects from the client and server sides?
> >No way! Never pass database objects to/from the server. You don't need to.
> >
> >Each database object is derived from OzoneCompatible wich provides the
> >database() method. This method returns the proper database object for the
> >database object.
> 
> Got it. Sorry I missed that critical fact. I was using an approach from a 
> previous application that doesn't apply with ozone.

If your previous application was using ODMG then you may re-use your knowledge
by programming against the ODMG interface of ozone instead of using the native
ozone interface. Of course, it's better, faster, smoother, whatever to use the
native ozone interface ;) However, the ozone ODMG interface may save you time.
(and I would get some real worls experiences about it ;) Anyway, just an idea.


Falko
-- 
______________________________________________________________________
Falko Braeutigam                              mailto:falko@smb-tec.com
SMB GmbH                                        http://www.smb-tec.com