> For the complete documentation index, see [llms.txt](https://jnosql.gitbook.io/jnosql-book/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://jnosql.gitbook.io/jnosql-book/en/part5/chapter5_4.md).

# The repository class

The "maestro" persistence class has synchronous and asynchronous. These interfaces are extended mainly to add a feature that has a Diana driver, but the Artemis API does not support, eg., the live query at OrientDB, consistency level. To make secure an extension there is template method class.

* AbstractKeyValueRepository
* AbstractColumnRepository
* AbstractColumnRepositoryAsync
* AbstractDocumentRepository
* AbstractDocumentRepositoryAsync

To demonstrate, it will create a `ColumnRepository` extension to supports a Cassandra methods that do exists on diana-driver: Cassandra Query Language and consistency level.

```java
public class CassandraColumnRepository extends AbstractColumnRepository {

    @Inject
    private ColumnEntityConverter converter;

    @Inject
    private CassandraColumnFamilyManager manager;

    @Inject
    private ColumnWorkflow workflow;

    @Inject
    private ColumnEventPersistManager eventManager;

    @Override
    protected ColumnEntityConverter getConverter() {
        return converter;
    }

    @Override
    protected ColumnFamilyManager getManager() {
        return manager;
    }

    @Override
    protected ColumnWorkflow getFlow() {
        return workflow;
    }

    @Override
    protected ColumnEventPersistManager getEventManager() {
        return eventManager;
    }

    public <T> T save(T entity, ConsistencyLevel level) {
        Objects.requireNonNull(entity, "entity is required");
        Objects.requireNonNull(level, "level is required");
        UnaryOperator<ColumnEntity> save = e -> manager.save(e, level);
        return workflow.flow(entity, save);
    }

    public <T> T save(T entity, Duration ttl, ConsistencyLevel level) throws NullPointerException {
        Objects.requireNonNull(entity, "entity is required");
        Objects.requireNonNull(level, "level is required");
        UnaryOperator<ColumnEntity> save = e -> manager.save(e, ttl, level);
        return workflow.flow(entity, save);
    }

    public <T> List<T> cql(String query) throws NullPointerException {
        Objects.requireNonNull(query, "query is required");
        List<ColumnEntity> entities = manager.cql(query);
        return entities.stream().map(converter::toEntity).map(c -> (T) c)
                .collect(Collectors.toList());
    }

    public void delete(ColumnDeleteQuery query, ConsistencyLevel level) throws NullPointerException {
        manager.delete(query, level);
    }

}
```

To conclude, extending the AbstractColumnRepository the CassandraColumnRepository will have support to the methods on Artemis interface and also append the Cassandra resources.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://jnosql.gitbook.io/jnosql-book/en/part5/chapter5_4.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
