Skip to content

Commit

Permalink
fixes #1093 (#1105)
Browse files Browse the repository at this point in the history
* fixes #1093

* build fix
  • Loading branch information
anidotnet authored Jan 23, 2025
1 parent d550be1 commit 5c96ec1
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@
import com.esotericsoftware.kryo.kryo5.serializers.MapSerializer;
import org.dizitart.no2.collection.Document;
import org.dizitart.no2.collection.NitriteId;
import org.dizitart.no2.common.meta.Attributes;
import org.dizitart.no2.common.DBValue;
import org.dizitart.no2.common.Fields;
import org.dizitart.no2.common.meta.Attributes;
import org.dizitart.no2.common.tuples.Pair;
import org.dizitart.no2.common.DBValue;
import org.dizitart.no2.common.util.SpatialKey;
import org.dizitart.no2.index.BoundingBox;
import org.dizitart.no2.index.IndexDescriptor;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -443,6 +443,31 @@ public void run() {
db.close();
}

@Test
public void testIssue1093() {
ObjectRepository<Receipt> repository = db.getRepository(Receipt.class);
repository.clear();

Receipt receipt1 = new Receipt();
receipt1.clientRef = "111-11111";
receipt1.status = Receipt.Status.PREPARING;

Receipt receipt2 = new Receipt();
receipt2.clientRef = "222-22222";
receipt2.status = Receipt.Status.PREPARING;

repository = db.getRepository(Receipt.class);
repository.update(receipt1, true);
repository.update(receipt2, true);

assertEquals(repository.find().size(), 2);
Receipt found1 = repository.getById("111-11111");
assertNotNull(found1);

Receipt found2 = repository.getById("222-22222");
assertNotNull(found2);
}

@Data
@AllArgsConstructor
@NoArgsConstructor
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ public void clearAll() {
String indexMapName = indexMeta.getIndexMap();
NitriteMap<?, ?> indexMap = nitriteStore.openMap(indexMapName, Object.class, Object.class);
indexMap.clear();
indexMap.close();
}
}
}
Expand Down
7 changes: 3 additions & 4 deletions nitrite/src/main/java/org/dizitart/no2/common/DBNull.java
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
package org.dizitart.no2.common;

import lombok.Getter;

/**
* @author Anindya Chatterjee
* @since 1.0
*/
public class DBNull extends DBValue {
private static final long serialVersionUID = 1598819770L;
@Getter
private static final DBNull instance = new DBNull();

private DBNull() {
Expand All @@ -22,10 +25,6 @@ public int compareTo(DBValue o) {
return -1;
}

public static DBNull getInstance() {
return instance;
}

@Override
public String toString() {
return null;
Expand Down

0 comments on commit 5c96ec1

Please sign in to comment.