Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Storing UUID in HSQLDB database

Tags:

java

uuid

hsqldb

I wish to store UUIDs created using java.util.UUID in a HSQLDB database.

The obvious option is to simply store them as strings (in the code they will probably just be treated as such), i.e. varchar(36).

What other options should I consider for this, considering issues such as database size and query speed (neither of which are a huge concern due to the volume of data involved, but I would like to consider them at least)

like image 524
William Avatar asked Dec 15 '09 16:12

William


1 Answers

HSQLDB has a built-in UUID type. Use that

CREATE TABLE t (
  id UUID PRIMARY KEY
);
like image 142
Lukas Eder Avatar answered Oct 20 '22 10:10

Lukas Eder