objectbox / objectbox/objectbox-java
Allow @Entity to override same name property of @BaseEntity
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 4.6k
- Forks
- 311
- PR merge metrics
- No merged PRs in 30d
Description
Trying to add same name variable in Entity which is already defined in parent class annotated by BaseEntity.
@Entity
public class Child extends Parent {
@Id(assignable = true)
public long id;
}
@BaseEntity
public class Parent {
@Id
public long id;
}
Building the project throws the following error:
error: [ObjectBox] Could not add property: Duplicate name "id" in entity "Child": [Property id of Child] vs. [Property id of Child] (com.mecofarid.myapplication.Child.id)
public long id;
Is there any workaround or method to override the same name variable in the child class?
Note: Removing BaseEntity annotation from Parent class builds successfully
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
Start by reproducing the build with the Child and Parent Java classes shown in the issue, including both @Id fields and @BaseEntity. Compare the generated duplicate-property error with the successful build after removing @BaseEntity. Done means determining whether the inheritance case is supported and documenting or implementing a confirmed workaround.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- databases
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100