问题描述:

I am trying to write logging records to a table over the course of a job. Unfortunately, despite the fact that the table exists (confirmed by querying the table using a JDBC client), Kundera does not believe it exists, throwing:

com.impetus.kundera.configure.schema.SchemaGenerationException:

InvalidRequestException(why:unconfigured columnfamily ingestionBatchSummary)

This is my persistence.xml:

<persistence-unit name="cassandra_pu">

<provider>com.impetus.kundera.KunderaPersistence</provider>

<properties>

<property name="kundera.client.lookup.class"

value="com.impetus.kundera.client.cassandra.dsdriver.DSClientFactory" />

<property name="kundera.ddl.auto.prepare" value="validate" />

</properties>

</persistence-unit>

Along with the properties file I'm loading from when I create the EntityManager (loaded with ApplicationConfiguration.getProperties()):

kundera.nodes=127.0.0.1

kundera.port=9042

kundera.keyspace=migration

kundera.username=notsecret

kundera.password=supersecret

And my entity:

@Entity

@Table(name="ingestionBatchSummary")

public class BatchSummary {

@Id

@Column(name="batchUuid")

private UUID batchUUID; //UUID of Batch

@Column(name="stuff")

private String stuff; //log contents

//Getters, setters

}

And the magic line that throws my error:

EntityManagerFactory emfactory = Persistence.createEntityManagerFactory("cassandra_pu",

ApplicationConfiguration.getProperties());

I've confirmed that the keyspace and table exists by querying them, I've confirmed that the properties match the server, I've confirmed that the properties are properly loaded (successful connection and keyspace appears in logs). Is there any other reason why Kundera might fail to recognize the existence of this table?

网友答案:

Figured out my problem: the table was created with CREATE TABLE IngestionBatchSummary instead of CREATE TABLE "IngestionBatchSummary". As a result, the table existed with an all lowercase name. I was missing this fact because my JDBC queries also did not include the quotes, whereas clearly Kundera's queries do.

相关阅读:
Top