In today’s article, we will take a look at composite primary key support in two top Java ORMs: jOOQ and Hibernate . We’ll look at a couple examples, learn how column configuration looks in Hibernate, and how support is organized in jOOQ.Thecomposite primary keyis a key that consists of more than one column, and its column combination guarantees its uniqueness.To handle the connection to the database, the application uses libraries known as object-relational mappers, or ORMs. Let’s see how jOOQ and Hibernate support this functionality.
In several of the projects we have worked on, customers have asked us to log more user actions in the database. They want to know all of the actions the users perform in the application, but capturing and recording all human interactions can be challenging. We had to log all modifications of data performed via the system. This article describes some of the pitfalls we encountered and the approaches that we used to overcome them.
Before writing this article, I talked to a group of software engineers who use Hibernate on a daily basis in their work. Some of them work for small companies (up to 20 developers on site) while others are employed in corporations known world-wide that employ over 100,000 IT professionals. This gave me an insight into how development with Hibernate is organized in different companies.There are several approaches to creating SQL scripts and Hibernate O/R Mapping classes.
In the Java world, there are many standards. Some of them have grown up from commonly used libraries or frameworks. For example, JPA, which was highly influenced by Hibernate.Standards are good. They eliminate chaos and bad practices. But standards shouldn’t be a kind of Bible for developers. A set of tools used in the project should be chosen consciously, not blindly “because it’s a standard and others use it.” It’s like in the business market, where a monopoly causes a lot more harm than good.