Important Notice: Our web hosting provider recently started charging us for additional visits, which was unexpected. In response, we're seeking donations. Depending on the situation, we may explore different monetization options for our Community and Expert Contributors. It's crucial to provide more returns for their expertise and offer more Expert Validated Answers or AI Validated Answers. Learn more about our hosting issue here.

What is the best way to generate a universally unique object ID? Do I need to use an external resource like a file or database, or can I do it all in memory?

0
10 Posted

What is the best way to generate a universally unique object ID? Do I need to use an external resource like a file or database, or can I do it all in memory?

0
10

Location: http://www.jguru.com/faq/view.jsp?EID=1030397 Created: Nov 25, 2002 Modified: 2003-02-28 08:01:34.258 Author: Alessandro A. Garbagnati (http://www.jguru.com/guru/viewbio.jsp?EID=32727) Question originally posed by Andy Brown (http://www.jguru.com/guru/viewbio.jsp?EID=1027054 [I need to generate unique id’s that will be used for node ‘ID’ attribute values within XML documents. This id must be unique system-wide. The generator must be available to a number of servlets that add various node structures to my XML docs as a service. What is the best way to tackle this? The ‘possible’ ways I can see: • Keep the maximum ID value in a flat-file where the service would read it upon start-up and increment it. Upon shutdown or failure, it would write the latest max id to the file. • Calculate the max id by searching the XML itself. This will be tougher since XML requires an alpha-numeric value (not strictly numeric). • Use a database (MySQL) with a two-field table where one field is the

Related Questions

What is your question?

*Sadly, we had to bring back ads too. Hopefully more targeted.

Experts123