Should the repository layer return data-transfer-objects (DTO)?

Short answer: No. Long answer: repository is responsible for turning persisted data back to entities (models) and vice versa. Model is a business Model representing a business entity. DTO on the other hand – while looks like Model – is concerned with transfer of the object between various environment and in essence is a transient … Read more

What is the best way to improve performance of NHibernate? [closed]

The first and most dramatic performance problem that you can run into with NHibernate is if you are creating a new session factory for every session you create. Only one session factory instance should be created for each application execution and all sessions should be created by that factory. Along those lines, you should continue … Read more

How to write unit tests for database calls

What are you testing? There are three possibilities, off the top of my head: A. You’re testing the DAO (data access object) class, making sure it’s correctly marshaling the values/parameters being passed to the database,, and correctly marshaling/transforming/packaging results gotten frm the database. In this case, you don’t need to connect to the database at … Read more

What is the difference between DAO and Repository patterns?

DAO is an abstraction of data persistence. Repository is an abstraction of a collection of objects. DAO would be considered closer to the database, often table-centric. Repository would be considered closer to the Domain, dealing only in Aggregate Roots. Repository could be implemented using DAO‘s, but you wouldn’t do the opposite. Also, a Repository is … Read more

Separation of business logic and data access in django

It seems like you are asking about the difference between the data model and the domain model – the latter is where you can find the business logic and entities as perceived by your end user, the former is where you actually store your data. Furthermore, I’ve interpreted the 3rd part of your question as: how … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)