JPA @OneToMany and composite primary key

To implement an parent object in one-to-many relation with a child object that has a composite primary key (i.e. multiple columns as primary key) is not quite straightforward.

We need to use a mix of JPA annotations along with creating some embeddable classes.

 

(Rock) SOLID

This article is the follow-up of the previous article on the basics of software development, to remind myself of what I learned in the beginning of my software developer career.

This one will deal with the famous SOLID design principles:

  • Single responsibility principle
  • Open/closed principle
  • Liskov substitution principle
  • Interface segregation principle
  • Dependecy inversion principle
 

Back to basics

I learned programming concepts mostly during my school years. Unfortunately, during my professional career, when coding, I no longer used those words and I feel like I sportsman that demonstrates what’s the “way” to code instead of explaining using common concepts to my peers.

For example, I hear myself say “This feels more right doing this way because I feel that way should bring us less trouble in the future”, even after several years of development… That’s kinda sad as I’m no longer some new guy freshly coming out of school.

The purpose of this article is to remind myself the fundamental concepts and patterns.