Design Patterns used in Hibernate Framework

In this post, let's discuss a different kind of design patterns which are widely used in the Hibernate Framework. Design Patterns denote the best computer programming practices in object-oriented software development. Hibernate framework has been built by using the following design pattern or standard practices.
I listed few known design patterns used in Hibernate Framework.
Please leave a comment, if you know any other design patterns used in Hibernate Framework.

You can also read my post of Design Patterns used in Spring Framework.

Domain Model Pattern

The domain model is treated as POJO in Hibernate.

The domain model is an object model of the domain that incorporates both behavior and data.

Read more about Domain Model Pattern here at https://stackoverflow.com/questions/41335249/domain-model-pattern-example

Proxy Design Pattern

Proxy Pattern for lazy loading - https://docs.jboss.org/hibernate/orm/3.3/reference/en/html/performance.html

Proxy Pattern provides a surrogate or placeholder for another object to control access to it.

Read more about Proxy Design Pattern here at http://ramesh-java-design-patterns.blogspot.in/2017/12/proxy-design-pattern.html

Factory Design Pattern

SessionFactory of Hibernate is an example of the Factory Design Pattern.

This pattern defines an interface for creating an object, but let subclasses decide which class to instantiate. Factory Method lets a class defer instantiation to subclasses.

Read more about Proxy Design Pattern here at https://ramesh-java-design-patterns.blogspot.in/2017/12/factory-design-pattern.html

Query Object Pattern

Hibernate Criteria API and the modern JPA2 Criteria API are an excellent examples Query Object Pattern.

Read more about Query Object Pattern here at https://stackoverflow.com/questions/2068478/query-object-pattern-design-pattern

Data Mapper Pattern

A layer of Mappers that moves data between objects and a database while keeping them independent of each other and the mapper itself.

Read more about Data Mapper Pattern here at https://en.wikipedia.org/wiki/Data_mapper_pattern

Unit of Work

This pattern as part of Session object in hibernate.

Read more about Unit of Work here at https://martinfowler.com/eaaCatalog/unitOfWork.html

Comments

  1. Good Post! Thank you so much for sharing this pretty post, it was so good to read and useful to improve my knowledge as updated one, keep blogging.

    Hibernate Training in Electronic City

    ReplyDelete

Post a Comment