objectbox / objectbox/objectbox-java

Grouping Multiple Unique

Open
#672 1 comment 6 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
Java
Stars
4.6k
Forks
311
PR merge metrics
No merged PRs in 30d

Description

Right now, if I assign @Unique to multiple properties, it will check each property and throw if just one matches.

But is there a way to group these together?

For example:
@Unique String firstName
@Unique String lastName

Currently:
put(new Name("James", "Hunt")) -> saved
put(new Name("James", "Lee")) -> UniqueViolationException

Expected:
put(new Name("James", "Hunt")) -> saved
put(new Name("James", "Lee")) -> saved

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing how @Unique is applied and how put(...) enforces uniqueness. Compare the current per-property behavior with the requested combined constraint using the Name examples; done means records sharing one property can be saved when the combined values are unique.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
databases
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.