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

Re: Object id question



On Fri, 17 Mar 2000, Phillip Rhodes wrote:
> Stupid question:
> 
> I am writing an EJB application using ozone as the persistence mechanism. 
>  The front end of the application will be in JSP.  To be able to tie an 
> object to an html interface, I need a unique identifier for that object.
> 
> 
> Would you recommend the object id of the object for this usage?

The objectID of a database object is guaranteed to be unique between all
database objects. So it probably meets the needs of your application. 

However, currently there is no API to access it from the user code. Of course,
container.id() would work but ObjectContainer and ObjectID are located in the
core package and so they are not part of the API. Although I don't expect these
things to change that much overtime, it may happen.

> 
> I am also concerned that with every addition of an object (between a 
> connect/disconnect), the object id increments by 1000.

The object ID consists of 48 bits that identify the object in one server and 16
bits that identify the server of the object. The server maintains a counter to
be able to produce unique IDs. In opposit to a time stamp a counter uses each
possible value out of the 2^48 range. That counter is stored in the
state.properties of the server. To avoid accessing the file each time an object
is created the server increases the counter by 1000. So in the worst case it
looses 999 IDs each time it is *re-started* (not connected!). Since a database
server is not expected to go down that often this seemed to be the fastest
solution.


Falko
-- 
______________________________________________________________________
Falko Braeutigam                         mailto:falko@softwarebuero.de
softwarebuero m&b (SMB)                    http://www.softwarebuero.de