Models like Scala class classes interacting with DAO?

I started design with Scala class classes as models, and I was interested to learn about the design decision.

Suppose we have two models: a model Userand a model Order. The model Orderrefers to the model Useras a foreign key.

case class User(id: UserId, [Other fields...], password: String)
case class Order(id: OrderId, [Other fields...], userId: UserId)

Then, given this construction, we will have a OrdersDAO with the method findByUser.

My question is: will a good design have a method Ordersin Userthat calls this DAO method and thus makes the system more OO or better isolate layers and not include this method

Thank!

+4
source share

Source: https://habr.com/ru/post/1533118/


All Articles