![]() annotation creates an OneToMany relationship between Recipe entity and the Ingredient entity.= GenerationType.IDENTITY) annotation sets the id field to be autogenerated and GenerationType.IDENTITY marks the field as unique.annotation marks the id field as the primary for the database table that will be generated from the Recipe entity.annotation marks the Recipe data class as a JPA entity that can be persisted into the database.Import data class = GenerationType.IDENTITY) //Uses underlying persistence framework to generate an Id ![]() In the Recipe.kt file we created earlier, add the code snippets below. From our entity relationship diagram above we can see that the Recipe entity has a OneToMany relationship with the ingredient entity meaning that a single recipe is capable of having several ingredients. In this type of JPA relation, a row in the parent entity is referenced by many child records in another entity. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |