access. I was working on the problem of creating multiple records in
different data sources and having to combine them at a later date. I
also wanted a generic way to insert a record and get the record back
without having to try to get an auto-generated key back from different
drivers and databases. This of course led to the idea that I needed a
unique number. What is the best way to do this inside of Phobos? You
first might think of someway to do it in Javascript, but this is where
we would be wrong. This is where the prowess of the Java platform comes
in. We tap the power of Java from our scripting language to do some
heavy lifting for us. So how much code does it take?
key = java.util.UUID.randomUUID().toString();
That's it! Now it may not be as random as a GUID, but it will work for
almost all situations, especially on small projects. We just tap a Java
class to accomplish this for us. There are other Javascript server
applications out there, but with the Java underpinnings, Phobos is hard
to beat.