• contact@easenotes.com
  • Phone: (+91) 9964716807
Hibernate programming notes for freshers and experienced developer
Views

Hibernate programming notes for freshers and experienced developer

Loading...

Getting started with Hibernate Hibernate programming notes for freshers and experienced developer

Chapters of Hibernate for developers 

Chapter 1: Getting Started with Hibernate
...................................................................................................... 2
Section 1.1: Using XML Configuration to set up Hibernate................................................................................... 2
Section 1.2: Simple Hibernate example using XML ............................................................................................. 4
Section 1.3: XML-less Hibernate configuration ................................................................................................... 6
Chapter 2: Fetching in Hibernate
.......................................................................................................................... 8
Section 2.1: It is recommended to use FetchType.LAZY. Join fetch the columns when they are needed
.................................................................................................................................................................................. 8
Chapter 3: Hibernate Entity Relationships using Annotations
............................................................ 10
Section 3.1: Bi-Directional Many to Many using user managed join table object Section 3.2: Bi-Directional Many to Many using Hibernate managed join table
................................................ 10
.................................................. 11
Section 3.3: Bi-directional One to Many Relationship using foreign key mapping ......................................... 12
Section 3.4: Bi-Directional One to One Relationship managed by Foo.class ................................................. 12
Section 3.5: Uni-Directional One to Many Relationship using user managed join table ................................. 13
Section 3.6: Uni-directional One to One Relationship ................................................................................. 14
Chapter 4: HQL
............................................................................................................................................................ 15
Section 4.1: Selecting a whole table Section 4.2: Select specific columns Section 4.3: Include a Where clause
Section 4.4: Join ........................................................................................................................................... 15
Chapter 5: Native SQL Queries
Section 5.1: Simple Query .............................................................................................................................. 16
Section 5.2: Example to get a unique result .............................................................................................. 16
Chapter 6: Mapping associations
....................................................................................................................... 17
Section 6.1: One to One Hibernate Mapping .................................................................................................... 17
Chapter 7: Criterias and Projections
................................................................................................................ 19
Section 7.1: Use Filters .................................................................................................................................. 19
Section 7.2: List using Restrictions ........................................................................................................... 20
Section 7.3: Using Projections ........................................................................................................................ 20
Chapter 8: Custom Naming Strategy
............................................................................................................... 21
Section 8.1: Creating and Using a Custom ImplicitNamingStrategy ................................................................... 21
Section 8.2: Custom Physical Naming Strategy ......................................................................................... 21
Chapter 9: Caching
..................................................................................................................................................... 24
Section 9.1: Enabling Hibernate Caching in WildFly .......................................................................................... 24
Chapter 10: Association Mappings between Entities
................................................................................ 25
Section 10.1: One to many association using XML............................................................................................ 25
Section 10.2: OneToMany association ............................................................................................................. 27
Chapter 11: Lazy Loading vs Eager Loading
................................................................................................. 28
Section 11.1: Lazy Loading vs Eager Loading ............................................................................................. 28
Section 11.2: Scope ...................................................................................................................................... 29
Chapter 12: Enable/Disable SQL log
................................................................................................................. 31
Section 12.1: Using a logging config file .................................................................................................... 31
Section 12.2: Using Hibernate properties ........................................................................................................ 31
Section 12.3: Enable/Disable SQL log in debug ................................................................................................ 31
Chapter 13: Hibernate and JPA
............................................................................................................................ 33
Section 13.1: Relationship between Hibernate and JPA .................................................................................... 33
Chapter 14: Performance tuning
........................................................................................................................ 34
Section 14.1: Use composition instead of inheritance ....................................................................................... 34