Design: hide table structure from upper layers of application?

11 views
Skip to first unread message

John

unread,
Dec 25, 2017, 12:07:14 AM12/25/17
to Slick / ScalaQuery
My model consists of a set of case classes. I have DAO's for persisting the model. Nothing outside of the DAO's knows anything about slick or the structure of the tables models are persisted to.

The cost of keeping slick and db details hidden is an extreme lack of flexibility. For example, it's necessary to have a find method for every single combination of parameter I want to query based on, and I can't easily compose queries.

It seems like that in order to use slick effectively I have to have many layers of the application using it directly. The lack of encapsulation/modularity worries me.

1. Is there a way to keep the persistence layer neatly encapsulated without losing flexibility and the key functionality that makes slick useful?
2. Alternately, is neatly encapsulating the persistence layer a misguided goal?

Thanks,

-John

Reply all
Reply to author
Forward
0 new messages