Hi,
I have a simple JPA repository.
The entity contains UUID as primary key.
My test is under Cassandra OGM datastore (5.2.0-SNAPSHOT) and Hibernate core is 5.1.5.Final.
I use this as my local container :
Code:
l.getJpaPropertyMap().put("hibernate.ogm.datastore.provider", "org.hibernate.ogm.datastore.cassandra.impl.CassandraDatastoreProvider");
l.getJpaPropertyMap().put("hibernate.ogm.datastore.host", cassandraHost);
l.getJpaPropertyMap().put("hibernate.ogm.datastore.database", "keyspace1");
My entity is like :
Code:
@Entity
@org.hibernate.search.annotations.Indexed
public class PERSON{
@Id
UUID id;
String name;
}
My repository is like :
Code:
public interface PERSONRepository extends JpaRepository<PERSON, UUID>{
}
When I save my entity with my repository, the database is correct.
But when I try :
Code:
UUID key = UUID.fromString("1f2504e0-4f89-11d3-9a0c-0305e82c3302");
PERSONRepository .existsById(key);
I have an exception :
org.springframework.dao.InvalidDataAccessApiUsageException: Invalid UUID string: 1; nested exception is java.lang.IllegalArgumentException: Invalid UUID string: 1
Is-it possible to use UUID as PK with Cassandra ORM ?
Best regards.
The problem seemes coming from the function ExistsById.
If I use findById(key).isPresent(), the response is correct.