ormmappingentitydesign-patterns

ORM Techniques or conceptual framework to one table, one class?


I wanna know if there exists conceptual framework or documented techniques to study how to map entities classes to database tables??

Before I was using JPA (Java Persistance API) to map one table -> one entity class, this is: each table's row represented by one object class. Is it the most common/correct way? Has these patterns specific names?

Thanks a lot.


Solution

  • One table to one class is called the "Active Record" pattern. One alternative pattern people use is the Repository pattern. DDD (Domain Driven Design) has the concept of Aggregate Roots which also plays in this space. You should be able to do some reading on that terminology. I am personally not in love with any of those patterns, they all have pros and cons.