0

ObjectBox documents several annotations that can be applied to and entity's properties. Can one property have multiple annotations?

For example, would this be a valid entity?

@Entity
data class User(
    @Id 
    var id: Long = 0,
    @Index 
    @Unique(onConflict = ConflictStrategy.REPLACE)
    var name: String = null,
)
pdiffley
  • 603
  • 9
  • 18

1 Answers1

1

Yes, a property (and and entity) can have multiple annotations.

Your example with @Index and @Unique is valid; however, because @Unique implies @Index, the latter is redundant and can be removed.

Markus Junginger
  • 6,950
  • 31
  • 52