我有这张Cassandra表:
CREATE TABLE xxx ( id timeuuid PRIMARY KEY);
和这堂课:
@Entity
@Table(name = "xxx", schema = "yyy")
public class XXX {
@Id
@GeneratedValue
public UUID id;
}
坚持下去,我得到:
线程“main”中的异常com.impetus.kundera.KunderaException:java.lang.IllegalArgumentException:GenerationType.AUTO此客户端不支持的策略:com.impetus.client.cassandra.pelops.PelopsClient 在com.impetus.kundera.persistence.EntityManagerImpl.persist(EntityManagerImpl.java:174) 在Importer.save(StayImporter.java:80) 在Importer.exec(StayImporter.java:92) 在Importer.main(StayImporter.java:100) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) 在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.client.cassandra.pelops.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) 在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>
答案 0 :(得分:0)
来自日志:
此客户端不支持GenerationType.AUTO策略com.impetus.client.cassandra.pelops.PelopsClient
我建议你使用Thrift客户端。您可以将kundera.client.lookup.class
中的persistence.xml
属性更改为以下内容:
<property name="kundera.client.lookup.class" value="com.impetus.client.cassandra.thrift.ThriftClientFactory" />
另外,我建议您使用latest version of Kundera-Cassandra。