[hibernate] What is the difference between DAO and Repository patterns?

Repository are nothing but well-designed DAO.

ORM are table centric but not DAO.

There's no need to use several DAO in repository since DAO itself can do exactly the same with ORM repositories/entities or any DAL provider, no matter where and how a car is persisted 1 table, 2 tables, n tables, half a table, a web service, a table and a web service etc. Services uses several DAO/repositories.

My own DAO, let's say CarDao only deal with Car DTO,I mean, only take Car DTO in input and only return car DTO or car DTO collections in output.

So just like Repository, DAO actually is an IoC, for the business logic, allowing persitence interfaces not be be intimidated by persitence strategies or legacies. DAO both encapsulates the persistence strategy and does provide the domaine-related persitence interface. Repository is just an another word for those who had not understood what a well-defined DAO actualy was.

Examples related to hibernate

Hibernate Error executing DDL via JDBC Statement How does spring.jpa.hibernate.ddl-auto property exactly work in Spring? Error creating bean with name 'entityManagerFactory' defined in class path resource : Invocation of init method failed JPA Hibernate Persistence exception [PersistenceUnit: default] Unable to build Hibernate SessionFactory Disable all Database related auto configuration in Spring Boot Unable to create requested service [org.hibernate.engine.jdbc.env.spi.JdbcEnvironment] HikariCP - connection is not available Hibernate-sequence doesn't exist How to find distinct rows with field in list using JPA and Spring? Spring Data JPA and Exists query

Examples related to domain-driven-design

What is the difference between DAO and Repository patterns? What is Domain Driven Design? Where do I find some good examples for DDD?

Examples related to ejb-3.0

What is the difference between DAO and Repository patterns? javax.naming.NameNotFoundException "detached entity passed to persist error" with JPA/EJB code use of entityManager.createNativeQuery(query,foo.class)

Examples related to repository-pattern

using stored procedure in entity framework What is the difference between DAO and Repository patterns? What's an Aggregate Root?

Examples related to data-access-layer

Separation of business logic and data access in django What is the difference between DAO and Repository patterns?