-
Notifications
You must be signed in to change notification settings - Fork 92
Compile Time Config
When using Achilles you should be aware of the fact that the framework is invoked at compile time and at runtime.
At compile time Achilles will parse your source code to generate additional source code. To configure Achilles at compile time, you can use the @CompileTimeConfig
annotation on a class or an interface
The interface/class can (and should) be empty. What interests us here is the attributes set on the annotation
@CompileTimeConfig(cassandraVersion = CassandraVersion.CASSANDRA_3_0_X,
columnMappingStrategy = ColumnMappingStrategy.IMPLICIT,
namingStrategy = NamingStrategy.SNAKE_CASE,
insertStrategy = InsertStrategy.ALL_FIELDS,
projectName = "Project1"
public interface AchillesCompileTimeConfig {
}
What you can specify as configuration at compile time are:
- the cassandra version. Default = CassandraVersion.CASSANDRA_3_0_X
- the column mapping strategy. Default = ColumnMappingStrategy.EXPLICIT
- the naming strategy. Default = NamingStrategy.LOWER_CASE
- the insert strategy. Default = InsertStrategy.ALL_FIELDS
- the project name. Default = ""
Please refer to the appropriate section for each of those parameters.
Specifying the Cassandra version will help Achilles unlock and generate new features that are only supported by this version and after.
For example, materialized views are not available before CassandraVersion.CASSANDRA_3_0_X
Below is the Cassandra version feature matrix:
Cassandra version | Supported features | Related JIRA(s) |
---|---|---|
2.1.X | All existing features | N/A |
2.2.X |
|
|
3.0.X |
|
|
3.1 | Nothing | N/A |
3.2 | Add support for type casting in selection clause | CASSANDRA-10310 |
3.6 |
|
|
3.7 |
|
|
DSE 4.8.X |
|
N/A |
DSE 5.0.X |
|
N/A |
And below is the impact of each new feature on Achilles-generated code:
Cassandra Feature | Achilles generated code |
JSON Syntax |
|
User Defined Function/User Defined Aggregates |
|
Materialized Views |
|
Support for IN restrictions on clustering columns for UPDATE/DELETE |
|
Support for multi-column slice restrictions (>, >=, <= and <) for DELETE |
|
Support for type casting in selection clause |
|
Support for PER PARTITION LIMIT |
|
Support for non-frozen user-defined types, updating individual fields of user-defined types
Remark: collections inside non-frozen UDT MUST be set as frozen |
|
Support for SASI index/DSE Search (on text/ascii columns): |
SASI:
|
Last but not least, the projectName()
attribute is crucial for those who are using Achilles for multiple projects.
For more details see Multi-Project support
-
Bootstraping Achilles at runtime
- Runtime Configuration Parameters
-
Manager
-
Consistency Level
-
Cassandra Options at runtime
-
Lightweight Transaction (LWT)
-
JSON Serialization
-
Interceptors
-
Bean Validation (JSR-303)