Reputation: 1
I have problem when create table with UUID type field using CassandraAdminOperations.createTable. I defined field in table with type uuid, but when the table was created using CassandraAdminOperations.createTable, the field was created as timeuuid. Is there any way to force the field to uuid instead of timeuuid ?
Here is the field definition in class,
@PrimaryKeyColumn(name = "id", ordinal = 0, type = PrimaryKeyType.PARTITIONED)
private UUID id;
@Column(value = "url")
private String url;
But when call CassandraAdminOperations.createTable to create the table, the log shows the following and the id filed was created as timeuuid,
00:43:23.877 [localhost-startStop-1] DEBUG o.s.d.c.core.CassandraAdminTemplate - CREATE TABLE IF NOT EXISTS id_to_url_map (id timeuuid, url text, PRIMARY KEY (id));
Thanks!
Upvotes: 0
Views: 1098
Reputation: 364
I had the same problem. But after some investigation, I found that you can add @CassandraType annotation, and explicitly specify the class.
import com.datastax.driver.core.DataType;
@PrimaryKeyColumn(name = "id", ordinal = 0, type = PrimaryKeyType.PARTITIONED)
@CassandraType(type = DataType.Name.UUID)
private UUID id;
Upvotes: 2