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

Re: Object Creation in ozone




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.

Thanks again for your help.

cheers,

don


________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com