shashank created CAMEL-26738:
--------------------------------

             Summary: docs - Key-Value Repository pages show old table names 
for the JDBC, JPA and Cassandra repositories
                 Key: CAMEL-26738
                 URL: https://issues.apache.org/jira/browse/CAMEL-26738
             Project: Camel
          Issue Type: Improvement
          Components: camel-jpa, camel-cassandraql, camel-sql
            Reporter: shashank
            Assignee: shashank


The {{JdbcKeyValueRepository}} section of the Key-Value Repository page 
({{keyValueRepository.adoc}}) says that {{tableName}} defaults to {{camel_kvr}} 
and shows this auto-created table:

{code:sql}
CREATE TABLE camel_kvr (
    kvr_key   VARCHAR(255) NOT NULL PRIMARY KEY,
    kvr_value TEXT
);
{code}

The repository creates a different table ({{DEFAULT_TABLENAME}} and 
{{DEFAULT_CREATE_STRING}} in {{JdbcKeyValueRepository}}), and 
{{CAMEL_KEYVALUE}} is the default of {{tableName}}:

{code:sql}
CREATE TABLE CAMEL_KEYVALUE (ITEM_KEY VARCHAR(512) NOT NULL, ITEM_VALUE BLOB 
NOT NULL, EXPIRES_AT BIGINT NOT NULL DEFAULT 0, PRIMARY KEY (ITEM_KEY))
{code}

A user who creates the table from the documentation gets a table the repository 
cannot use. The JDBC and JPA sections of {{key-value-repository.adoc}} in the 
user manual also name {{camel_kvr}} as the default table; the {{KeyValueEntry}} 
entity of camel-jpa maps to {{CAMEL_KEYVALUE}} as well.

The Cassandra sections of both pages name {{camel_kvr}} as the default table as 
well; {{CassandraKeyValueRepository}} uses {{camel_keyvalue}}. The user manual 
example calls {{setTableName}}, which does not exist (the setter is 
{{setTable}}), and says the table is created on startup, which the repository 
does not do.

Suggested fix: show the statement the code runs, say what {{ITEM_VALUE}} and 
{{EXPIRES_AT}} hold, and note that a database that does not accept that 
statement (no {{BLOB}} type, such as PostgreSQL) needs the table created by 
hand: with {{tableName}} set, all statements, {{createString}} included, are 
derived from the default ones. Use the real default table names and setter for 
Cassandra, and say that its table must be created beforehand.

_Filed with Claude Code on behalf of allthingssecurity._



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

Reply via email to