- Hibernate Annotation Configuration Tutorial with Complete Example using PostgreSQL
- Maven
- GIT
- GitHub
- Hibernate Locking and Caching
- Hibernate Criteria Queries
- JPA Criteria API
- Hibernate Query Language (HQL)
- Inheritance Strategies with JPA and Hibernate
- Hibernate Extensions
- List of annotations used in JPA and Hibernate
Question:
1. Create new Java project
2. Convert it to maven project
3. Add JPA, Hibernate, and JDBC dependencies
4. Replace the traditional
hibernate.cfg.xml
configuration file with a Java-based configuration using the Configuration
class in Hibernate or by leveraging the SessionFactory
setup programmatically.5. Create entity class Candidate with attribute Id (primary key) and name
6. Insert data into database table
7. Create new column mark (data type int)
8. Insert five rows
1. Name: "June" , mark: 67
2. Name: "April", mark: 90
3. Name: "Tom", mark: 80
4. Name: "Spike", mark: 70
5. Name: "Sibin", mark: 50
9. After insert five rows, fetch(list) all candidate from database using HQL query and print
10. Then fetch all candidate whose age is mark is greater than 75 and print
11. Then find candidate by id(2) and print candidate
12. Update candidate whose id = 2 and set new name = "Gayathri"
13. Delete candidate whose id = 1
Comments
Post a Comment