oop - Where should I instantiate entities from database in a Three-tier app? -


i'm creating 3-tiers application, , encountered problem.
have database holds data customers , class represents customer entity in app. problem is, don't know if should instantiate customer entity in data tier or in application tier.

creating customer entity in application tier seems more correct, because data tier supposed query data, mean need use "raw/unformatted" data in application tier , don't either.

anyone know "correct" way deal ?

database persists state , before can queried sate must saved. new customer entity instantiated application sent persistance saved. when application needs customer db, persistence (usually repository) restores customer.

note customer business entity, related not same customer table or customer orm entity data structure modeled database point of view optimized queries.


Comments

Popular posts from this blog

jquery - How can I dynamically add a browser tab? -

node.js - Getting the socket id,user id pair of a logged in user(s) -

keyboard - C++ GetAsyncKeyState alternative -