Overview @ManyToOne and @OneToMany are standard mappings in Hibernate. Understanding how to use them correctly is the key to mapping entities efficiently in Hibernate. In this post, I will show […]
Using Custom Converter In Hibernate
Overview Imagine this scenario, you have a legacy database that store weather data. The previous developer, due to various reason, store the temperature in the following format: id location temperature […]
Using @ColumnTransformer In Hibernate
Overview One of the lesser-known yet powerful annotations in Hibernate is @ColumnTransformer. This annotation let us apply SQL transformations on entity properties when interacting with the database. You can think […]
How To use @Formula in Hibernate
Overview From the official documentation, a Formula mapping defines a “derived” attribute (that means, not persisted), whose state is determined from other columns and functions when an entity is read […]
Understanding @Embedded and @Embeddable In Hibernate
Overview Using @Embedded and @Embeddable in hibernate can help you manage entities and their value type efficiently. The term embed signifies a has-a relationship. For example, in an online game […]
Understanding Candidate Keys, Primary Key, Natural Key, and Surrogate Keys in Hibernate
Overview In this article, I will delve into the concepts of candidate keys, primary keys, natural keys, and surrogate keys in the context of Hibernate. Candidate Keys A candidate key […]