我有这个 Cassandra 表:
CREATE TABLE xxx ( id timeuuid PRIMARY KEY);
和这个类:
@Entity
@Table(name = "xxx", schema = "yyy")
public class XXX {
@Id
@GeneratedValue
public UUID id;
}
坚持后,我得到:
线程“主”com.impetus.kundera.KunderaException 中的异常:java.lang.IllegalArgumentException:GenerationType.AUTO 策略不受此客户端支持:com.impetus.client.cassandra.pelops.PelopsClient at com.impetus.kundera.persistence。 EntityManagerImpl.persist(EntityManagerImpl.java:174) 在 Importer.save(StayImporter.java:80) 在 Importer.exec(StayImporter.java:92) 在 Importer.main(StayImporter.java:100) 在 sun.reflect.NativeMethodAccessorImpl。 invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java: 497) 在 com.intellij.rt.execution.application.AppMain.main(AppMain.java:144) 引起:java.lang。IllegalArgumentException:此客户端不支持 GenerationType.AUTO 策略:com.impetus.kundera.persistence.IdGenerator.onAutoGenerator(IdGenerator.java:116) 上 com.impetus.kundera.persistence 上的 com.impetus.client.cassandra.pelops.PelopsClient .IdGenerator.generateAndSetId(IdGenerator.java:71) 在 com.impetus.kundera.graph.ObjectGraphBuilder.getNode(ObjectGraphBuilder.java:111) 在 com.impetus.kundera.graph.ObjectGraphBuilder.getObjectGraph(ObjectGraphBuilder.java:75) 在com.impetus.kundera.persistence.PersistenceDelegator.persist(PersistenceDelegator.java:135) 在 com.impetus.kundera.persistence.EntityManagerImpl.persist(EntityManagerImpl.java:168) ... 还有 8 个PelopsClient 在 com.impetus.kundera.persistence.IdGenerator.onAutoGenerator(IdGenerator.java:116) 在 com.impetus.kundera.persistence.IdGenerator.generateAndSetId(IdGenerator.java:71) 在 com.impetus.kundera.graph.ObjectGraphBuilder。 getNode(ObjectGraphBuilder.java:111) at com.impetus.kundera.graph.ObjectGraphBuilder.getObjectGraph(ObjectGraphBuilder.java:75) at com.impetus.kundera.persistence.PersistenceDelegator.persist(PersistenceDelegator.java:135) at com.impetus .kundera.persistence.EntityManagerImpl.persist(EntityManagerImpl.java:168) ... 还有 8 个PelopsClient 在 com.impetus.kundera.persistence.IdGenerator.onAutoGenerator(IdGenerator.java:116) 在 com.impetus.kundera.persistence.IdGenerator.generateAndSetId(IdGenerator.java:71) 在 com.impetus.kundera.graph.ObjectGraphBuilder。 getNode(ObjectGraphBuilder.java:111) at com.impetus.kundera.graph.ObjectGraphBuilder.getObjectGraph(ObjectGraphBuilder.java:75) at com.impetus.kundera.persistence.PersistenceDelegator.persist(PersistenceDelegator.java:135) at com.impetus .kundera.persistence.EntityManagerImpl.persist(EntityManagerImpl.java:168) ... 还有 8 个111) 在 com.impetus.kundera.graph.ObjectGraphBuilder.getObjectGraph(ObjectGraphBuilder.java:75) 在 com.impetus.kundera.persistence.PersistenceDelegator.persist(PersistenceDelegator.java:135) 在 com.impetus.kundera.persistence.EntityManagerImpl .persist(EntityManagerImpl.java:168) ... 还有 8 个111) 在 com.impetus.kundera.graph.ObjectGraphBuilder.getObjectGraph(ObjectGraphBuilder.java:75) 在 com.impetus.kundera.persistence.PersistenceDelegator.persist(PersistenceDelegator.java:135) 在 com.impetus.kundera.persistence.EntityManagerImpl .persist(EntityManagerImpl.java:168) ... 还有 8 个
这是我的 pom.xml:
<repositories>
<repository>
<id>sonatype-nexus</id>
<name>Kundera Public Repository</name>
<url>https://oss.sonatype.org/content/repositories/releases</url>
</repository>
</repositories>
<dependency>
<groupId>com.impetus.client</groupId>
<artifactId>kundera-cassandra</artifactId>
<version>2.9</version>
</dependency>