Demonstrates how to use Hibernate generator "Foreign" key strategy and one-to-one mapping. Explains the how to user H2 In memory embedded db with Hibernate and spring. Gives you the idea on custome generator creation.
- Spring Core/ORM.
- Hibernate Framework.
- Lombok api.
- Gradle build and dependency management.
- Establish the One-to-One mapping between two tables.
- Child table must use the Parent table id as Foreign key and as well Primary key. (This way we can avoid extra primary key column creation, reduce the overhead to db)
- As soon as Parent record inserted the child record should get inserted.
- Java 7 or above.
- Gradle 2.3 or above.
Eclipse IDE.
1. Clone/download as zip.
2. run > gradle eclipse
This will create eclipse ide related files, now you can import as eclipse project.
Added Test class called DrugTest.java, Run as Junit test.