You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The DynamoDB's Document API implementation follows the *SINGLE TABLE* strategy, it means, the table will store multiple entity types. To satisfy this strategy, the implementation assumes that the target table will have a composed primary key:
601
-
602
-
- The `entityType` field as the partitioning key;
603
-
- The `id` field as the sort key;
604
-
605
-
To customize the partitioning key field name, you can define the following configuration
606
-
607
-
[source,properties]
608
-
----
609
-
jnosql.dynamodb.entity.pk=entityType
610
-
----
611
-
612
-
By default, the implementation doesn't create the table on-the-fly, letting this requirement for the users. If you prefer, the implementation is able to create the table on-the-fly as well. To activate this capability you should define explicitly the following configuration:
613
-
614
-
[source,properties]
615
-
----
616
-
jnosql.dynamodb.create.tables=true
617
-
----
618
-
619
-
The table will be created with the composed primary key mentioned previously.
620
-
621
600
Here's an example using DynamoDB's Document API with MicroProfile Config.
622
601
623
602
[source,properties]
@@ -648,7 +627,7 @@ public class ManagerSupplier implements Supplier<DynamoDBDocumentManager> {
648
627
649
628
=== Repository
650
629
651
-
The ```DynamoDBRepository``` interface is an extension of the ```Repository``` interface that allows execution of PartiQL via the ```@PartiQL``` annotation.
630
+
The `DynamoDBRepository` interface is an extension of the `Repository` interface that allows execution of PartiQL via the `@PartiQL` annotation.
@@ -681,9 +659,44 @@ NOTE: This implementation doesn't provide pagination on the queries.
681
659
682
660
[source,java]
683
661
----
684
-
List<Person> people = template.partiQL("select * from Person where name = ? ", params);
662
+
List<Person> people = template.partiQL("select * from Person where name = ? ", Person.class, params);
685
663
----
686
664
665
+
==== Creating the tables on-the-fly
666
+
667
+
[IMPORTANT]
668
+
====
669
+
It's highly recommended to create the tables in a proper way, paying attention to the partition key and sort key, as well as the indexes.
670
+
====
671
+
672
+
The DynamoDB implementation allows you to create tables on-the-fly, which can be useful for development and testing purposes. However, this feature should be used with caution in production environments, as it may lead to unexpected behavior or performance issues if not properly configured.
673
+
674
+
To create tables on-the-fly, you need to define the following properties:
675
+
676
+
Please note that you can establish properties using the https://microprofile.io/microprofile-config/[MicroProfile Config] specification.
677
+
678
+
[cols="DynamoDB"]
679
+
|===
680
+
|Configuration property |Description | Default value
681
+
682
+
|`jnosql.dynamodb.create.tables`
683
+
| If set to true, the implementation will create the tables on-the-fly when the application starts. This is useful for development and testing purposes, but should be used with caution in production environments.
684
+
| false
685
+
686
+
|`jnosql.dynamodb.<table>.pk`
687
+
| The partition key field name for the table. This is used to define the primary key of the table. The `<table>` part should be replaced with the actual table name.
688
+
| _id
689
+
690
+
|`jnosql.dynamodb.<table>.read.capacity.units`
691
+
| The read capacity units for the table. This defines the number of strongly consistent reads per second that the table can support.The `<table>` part should be replaced with the actual table name. It's optional.
692
+
| none
693
+
694
+
|`jnosql.dynamodb.<table>.write.capacity.units`
695
+
| The write capacity units for the table. This defines the number of strongly consistent writes per second that the table can support.The `<table>` part should be replaced with the actual table name. It's optional.
Copy file name to clipboardExpand all lines: jnosql-arangodb/src/main/java/org/eclipse/jnosql/databases/arangodb/mapping/ArangoDBDocumentRepositoryProxy.java
+8Lines changed: 8 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -48,6 +48,8 @@ class ArangoDBDocumentRepositoryProxy<T, K> extends AbstractSemiStructuredReposi
Copy file name to clipboardExpand all lines: jnosql-cassandra/src/main/java/org/eclipse/jnosql/databases/cassandra/mapping/CassandraRepositoryProxy.java
+8Lines changed: 8 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -43,6 +43,8 @@ class CassandraRepositoryProxy<T, K> extends AbstractSemiStructuredRepositoryPro
43
43
44
44
privatefinalConvertersconverters;
45
45
46
+
privatefinalEntitiesMetadataentitiesMetadata;
47
+
46
48
privatefinalEntityMetadataentityMetadata;
47
49
48
50
privatefinalClass<?> repositoryType;
@@ -55,6 +57,7 @@ class CassandraRepositoryProxy<T, K> extends AbstractSemiStructuredRepositoryPro
Copy file name to clipboardExpand all lines: jnosql-couchbase/src/main/java/org/eclipse/jnosql/databases/couchbase/mapping/CouchbaseDocumentRepositoryProxy.java
+8Lines changed: 8 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -43,6 +43,8 @@ class CouchbaseDocumentRepositoryProxy<T, K> extends AbstractSemiStructuredRepos
43
43
44
44
privatefinalConvertersconverters;
45
45
46
+
privatefinalEntitiesMetadataentitiesMetadata;
47
+
46
48
privatefinalEntityMetadataentityMetadata;
47
49
48
50
privatefinalClass<?> repositoryType;
@@ -54,6 +56,7 @@ class CouchbaseDocumentRepositoryProxy<T, K> extends AbstractSemiStructuredRepos
Copy file name to clipboardExpand all lines: jnosql-dynamodb/src/main/java/org/eclipse/jnosql/databases/dynamodb/communication/DefaultDynamoDBDatabaseManager.java
Copy file name to clipboardExpand all lines: jnosql-dynamodb/src/main/java/org/eclipse/jnosql/databases/dynamodb/communication/DynamoDBConfigurations.java
+5-2Lines changed: 5 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -23,8 +23,11 @@ public enum DynamoDBConfigurations implements Supplier<String> {
0 commit comments