Skip to content

Commit 2663112

Browse files
committed
fix: convertion to new id
Signed-off-by: Otavio Santana <[email protected]>
1 parent 5eb61ca commit 2663112

File tree

3 files changed

+11
-1
lines changed

3 files changed

+11
-1
lines changed

jnosql-orientdb/src/main/java/org/eclipse/jnosql/databases/orientdb/communication/DefaultOrientDBDocumentManager.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,9 @@ public DocumentEntity update(DocumentEntity entity) {
115115
.orElseThrow(() -> new IllegalArgumentException("For updates at DocumentEntity"));
116116
try (ODatabaseSession tx = pool.acquire()) {
117117
ODocument record = tx.load(recordId);
118+
entity.remove(RID_FIELD);
119+
entity.remove(ID_FIELD);
120+
entity.remove(VERSION_FIELD);
118121
toMap(entity).forEach(record::field);
119122
tx.save(record);
120123
updateEntity(entity, record);

jnosql-orientdb/src/main/java/org/eclipse/jnosql/databases/orientdb/communication/OrientDBConverter.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ static DocumentEntity convert(ODocument document) {
8484
.forEach(entity::add);
8585
entity.add(Document.of(RID_FIELD, document.field(RID_FIELD).toString()));
8686
entity.add(Document.of(VERSION_FIELD, document.getVersion()));
87+
entity.add(Document.of(ID_FIELD, document.field(RID_FIELD).toString()));
8788
return entity;
8889
}
8990

jnosql-orientdb/src/test/java/org/eclipse/jnosql/databases/orientdb/integration/OrientDBTemplateIntegrationTest.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717

1818
import jakarta.inject.Inject;
1919
import org.eclipse.jnosql.databases.orientdb.communication.DocumentDatabase;
20+
import org.eclipse.jnosql.databases.orientdb.communication.OrientDBDocumentConfigurations;
2021
import org.eclipse.jnosql.databases.orientdb.mapping.OrientDBTemplate;
2122
import org.eclipse.jnosql.mapping.Convert;
2223
import org.eclipse.jnosql.mapping.config.MappingConfigurations;
@@ -31,6 +32,7 @@
3132

3233
import java.util.Optional;
3334

35+
import static com.orientechnologies.orient.core.db.ODatabaseType.PLOCAL;
3436
import static java.util.UUID.randomUUID;
3537
import static org.assertj.core.api.Assertions.assertThat;
3638
import static org.eclipse.jnosql.communication.driver.IntegrationTest.MATCHES;
@@ -50,7 +52,11 @@ class OrientDBTemplateIntegrationTest {
5052

5153
static {
5254
DocumentDatabase.INSTANCE.get("library");
53-
System.setProperty(MappingConfigurations.DOCUMENT_DATABASE.get(), "library");
55+
System.setProperty(MappingConfigurations.DOCUMENT_DATABASE.get(), "jnosql");
56+
System.setProperty(OrientDBDocumentConfigurations.HOST.get(), "/tmp/db/");
57+
System.setProperty(OrientDBDocumentConfigurations.USER.get(), "root");
58+
System.setProperty(OrientDBDocumentConfigurations.PASSWORD.get(), "rootpwd");
59+
System.setProperty(OrientDBDocumentConfigurations.STORAGE_TYPE.get(), PLOCAL.toString());
5460
}
5561
@Test
5662
public void shouldInsert() {

0 commit comments

Comments
 (0)