ClusterJ's main purpose is to read, write, and update row
data in an existing database, rather than to perform DDL. You
can create the employee
table that matches
this interface, using the following CREATE
TABLE
statement, in a MySQL client application such as
mysql.
CREATE TABLE employee ( id INT NOT NULL PRIMARY KEY, first VARCHAR(64) DEFAULT NULL, last VARCHAR(64) DEFAULT NULL, municipality VARCHAR(64) DEFAULT NULL, started DATE DEFAULT NULL, ended DATE DEFAULT NULL, department INT NOT NULL DEFAULT 1, UNIQUE KEY idx_u_hash (lname,fname) USING HASH, KEY idx_municipality (municipality) ) ENGINE=NDBCLUSTER;
Now that the table has been created in MySQL Cluster, you can map a ClusterJ interface to it using annotations. We show you how to do this in the next section.