In Apache Ignite 3.0.0, the `@QuerySqlField` annotation has indeed been
removed as part of a major architectural overhaul. This significant
change affects how you define queryable fields in your domain models.
For Ignite 3.0.0, the recommended approach is to use the new Table API
instead of annotations. In this new model, you define tables
programmatically rather than using annotations on your Java classes.
Here's how you can transition from the annotation-based approach to the
new Table API:
1. Instead of annotating fields with `@QuerySqlField`, you'll now create
table definitions using `TableDescriptor` and the fluent API.
2. Basic example of creating a table in Ignite 3.0.0:
```java
TableDescriptor table = TableDescriptor.builder()
.name("MyTable")
.addColumn("id", ColumnType.INT32, true) // primary key
.addColumn("name", ColumnType.STRING)
.addColumn("age", ColumnType.INT32)
.build();
tables.createTable(table).get();
```
3. For working with the data, you'll use the Table API methods for CRUD
operations rather than putting/getting annotated objects.
The shift from 2.x to 3.0.0 is substantial and requires rethinking your
data model approach. The new version moves away from the "object in the
cache" model toward a more traditional table-based database approach.
If you have a significant investment in the annotation-based approach
and need to maintain compatibility, you might consider:
1. Staying on Ignite 2.x for the time being
2. Creating an abstraction layer in your code to isolate the
Ignite-specific parts, making future migration easier
3. Gradually migrating components to use the new Table API while
maintaining the old components on 2.x
The Ignite 3.0 documentation provides comprehensive guidance on the new
Table API and migration strategies from 2.x.
João Lola:
I am currently using Apache Ignite 2.17.0 on a project I am working on,
I am interested in upgrading to 3.0.0. But I notice query annotations,
e.g @QuerySqlField are no longer available as of 3.0.0, so my question
is what can I use in 3.0.0 to replace it if available, if not what is
recommend to use instead?