Data Mapper Pattern
Learn Data Mapper Pattern (Data Access Patterns, Enterprise Design Patterns) with worked examples, diagrams and interview questions. Free on JavaSchoolLab.
What is the Data Mapper Pattern? A Data Mapper is a separate layer of objects that moves data between plain domain objects and a database, while keeping the domain objects, the database schema, and the mapper itself completely independent of each other. • The domain object (e.g. Employee ) has NO idea a database exists - no save()/find() methods on it, no SQL, no JDBC imports. • The Mapper is the only thing that knows how to translate between the object's fields and the database columns. • This separation is exactly what Hibernate/JPA implement internally: your @Entity classes stay plain Java...