Demostration how to break deep associations in RDBMS design
all database schema is in src/main/resources/db-schema.sql
. the sample codes use HSQLDB for
demostration.
SocialDao
and SocialDaoTest
isolated from concrete classes Article
and Comment
.
The codes is modular and easier to test.
Comment
and Article
both implementss LikeableEntity, demostration how to do
polymorphic associations. see CommentService.likeComment
and ArticleService.likeArticle
.
Article
demo how to implement two associations at the same time. Article can implement
LikeableEntity
and ShareableEntity
interfaces because it use UUID as primary key.
You need to install Gradle first. then execute below command to run unit tests.
gradle test
the command will generate Eclipse specfic setting files:
gradle cleanEclipse eclipse