This project include how to build a one to one relationship with hibernate annotations.
This app used
1 Maven
2 Hibernate
3 J2SE
4 Mysql
Database Design
This is final project structure
So we can start the project with download dependencies with Apache Maven, So for do it we have to change pom file like below. Then maven will download all the dependencies to your project easily.
Ok now we are ready to code the project so first we have to do is create data model objects (VO-Value Objects).
This HIbUtil Class is same for every hibernate project , So we have to do is add our VO classes as hibernate configurations. So add VO classes like this.
This code lines have to add to hib util file below "config.configure("hibernate.cfg.xml");" Ok now we have to create our hibernate.cfg.xml file in the project. Ok now we have to run this app with java main class. Run it :) Thats all
This app used
1 Maven
2 Hibernate
3 J2SE
4 Mysql
Database Design
This is final project structure
So we can start the project with download dependencies with Apache Maven, So for do it we have to change pom file like below. Then maven will download all the dependencies to your project easily.
Ok now we are ready to code the project so first we have to do is create data model objects (VO-Value Objects).
!!!Important Notes : When we add mappedby value in to onetoOne main table must be same name of second tables Primary keys value (In this example "stockVO")
Ok now all set Now we have to create HIbUtil and Hibernate configurations xml to the project.
This code lines have to add to hib util file below "config.configure("hibernate.cfg.xml");" Ok now we have to create our hibernate.cfg.xml file in the project. Ok now we have to run this app with java main class. Run it :) Thats all



Comments
Post a Comment