Clone this wiki locally
- Entity classes must be annotated with @Entity
- Entity and embeddable classes must have a default no-argument constructor.
- Each entity must have a field annotated with @Id. This will be persisted as row key.
- There must be 1 and only 1 @Id per entity.
- Primary Key and Column fields type must be according to supported data types.
- All fields annotated with @Embedded and @ElementCollection are stored within the table. e.g. Super column(s)/User Defined Type(s) in cassandra and nested document(s) in MongoDB.
- Fields annotated with @Embedded and @ElementCollection must be a class annotated with @Embeddable with their class definition. (The JPA way!)
- Relationship entities annotated with @OneToOne, @OneToMany etc must be another entity class. (All above rules apply to them). They are stored as separate tables and foreign keys are maintained by kundera. (we'll get to that later)
Kundera does not add any new annotation to the JPA set of annotations. Rather, it gives new meaning to existing ones so that:
- The time to get started with Kundera is very less and you can journey ahead with Kundera, the usual JPA-way.
- There is a uniformity in annotation set across all data-stores
Some major annotations used by Kundera:
...and so on.
Here is a graphical representation of what different annotations map to your datastore terminology.