-
Notifications
You must be signed in to change notification settings - Fork 35
Cannot define an identity index with unique constraint #627
Description
Environment Details
- EclipseStore Version: 4.0.0
- JDK version:25
- OS:MacOS
- Used frameworks: e.g. MicroFramework X, Spring, ... : no framework
Describe the bug
A clear and concise description of what the bug is.
In the paragraph Identity indexing of the manual, the following sample throws an exception at runtime.
// identity index with unique constraint
final GigaMap gigaMap = GigaMap.Builder()
.withBitmapIdentityIndex(PersonIndices.id)
.withBitmapUniqueIndex(PersonIndices.id) // enforce uniqueness at runtime
...
.build();
Exception in thread "main" java.lang.RuntimeException: BitmapIndex already registered for name "id".
at org.eclipse.store.gigamap.types.BitmapIndices$Default.validateIndexToAdd(BitmapIndices.java:1005)
at org.eclipse.store.gigamap.types.BitmapIndices$Default.addUniqueConstraints(BitmapIndices.java:1048)
at org.eclipse.store.gigamap.types.GigaMap$Builder$Default.build(GigaMap.java:854)
at issues.Issue1.main(Issue1.java:33)
To Reproduce
Step by step instructions to reproduce the problem.
Compile an run the following class 👍 import org.eclipse.store.gigamap.types.GigaMap;
import org.eclipse.store.gigamap.types.IndexerString;
public class Issue1 {
public class Indexes {
public final static IndexerString id = new IndexerString.Abstract<>() {
@OverRide
protected String getString(final Type type) {
return type.getId();
}
public String name() {
return "id";
}
};
}
class Type {
private String id;
public String getId() {
return id;
}
}
public static void main(final String[] args) {
GigaMap.Builder().withBitmapIdentityIndex(Indexes.id).withBitmapUniqueIndex(Indexes.id).build();
}
}
Expected behavior
A clear and concise description of what you expected to happen.
Defining an identity index with unique constraint must be possible.
Screenshots
If applicable, add screenshots to help explain your problem.
Additional context
Add any other context about the problem here.
package issues;