0 votes
in JAVA by
What are Design Patterns used in Hibernate framework?

1 Answer

0 votes
by
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
...