Hi,
I was wondering if there is a sample somewhere on how to autogenerate a timeUUID for Cassadra.
Also, I noticed from the the code, while i was looking through trunk that the database is called with the now function and a time UUID is created, but only if the dataType is uuid is it used.
For efficiency, shouldnt you put this code in the case block for datatype? It doesnt seem to need to make a call unless the type is defintely UUID, although perhaps it always is.
Anyway, if you could tell me how to autogenerate timeUUID that would be awesome !
-brad
@Override
public Object generate(Client<?> client, String dataType)
{
CqlResult cqlResult = ((CassandraClientBase) client).execute("Select now() from system.schema_columns",
((CassandraClientBase) client).getRawClient("system"));
CqlRow cqlRow = cqlResult.getRowsIterator().next();
TimeUUIDType t = TimeUUIDType.instance;
UUID timeUUID = t.compose(ByteBuffer.wrap(cqlRow.getColumns().get(0).getValue()));
switch (dataType.toLowerCase())
{
case "uuid":
return timeUUID;
default:
return UUID.randomUUID();
}
}