objectbox / objectbox/objectbox-java
Embedded Objects
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 4.6k
- Forks
- 311
- PR merge metrics
- No merged PRs in 30d
Description
Hi,
I would like to store ValueObjects inside @Entity object, is it somehow supported?
What that basically mean is you can convert one class field into multiple database fields.
Solution 1)
Flatten the hierarchy
@Entity
public class Bill {
private String priceCurrency;
private Double priceAmount;
}
Solution 2)
Make relation
@Entity
public class Bill {
private ToOne<Money> price;
}
@Entity
public class Money {
@Id Long id;
private String currency;
private Double amount;
}
Solution 3)
Convert to one database field
@Entity
public class Bill {
@Convert(converter = MoneyConverter.class,dbType = String.class)
private Money money;
}
Neither of those solutions fit all my requirements which are
- Do not map manually between multiple class fields and ValueObject
- Do not use relation for performance/convenience reason
- Sum and compare ValueObjects fields such as
Double amount
Somebody have solution to this?
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
The issue does not name any source files, tests, or entry points. Start by locating the entity-mapping and value-conversion code, then determine whether embedded value objects can meet the stated requirements without manual field mapping, relations, or single-field conversion; done requires a documented, tested supported approach.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- database
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100