FetchType: Lazy/Eager loading for Hibernate & JPA
Thoughts on Java
by Thorben Janssen
3w ago
The post FetchType: Lazy/Eager loading for Hibernate & JPA appeared first on Thorben Janssen. Choosing the right FetchType is one of the most important decisions when defining your entity mapping. It specifies when your JPA implementation, e.g., Hibernate, fetches associated entities from the database. You can choose between EAGER and LAZY loading. The first one fetches an association immediately, and the other only when you use it. I explain... The post FetchType: Lazy/Eager loading for Hibernate & JPA appeared first on Thorben Janssen ..read more
Visit website
How to generate DAOs and queries with Hibernate
Thoughts on Java
by Thorben Janssen
3w ago
The post How to generate DAOs and queries with Hibernate appeared first on Thorben Janssen. Executing a query with Hibernate requires several lines of repetitive boilerplate code, and many developers have complained about that for years. You have to instantiate a Query object and set all bind parameter values before you can finally execute the query. Since version 6.3.1, Hibernate has solved this with an improved metamodel generator that provides... The post How to generate DAOs and queries with Hibernate appeared first on Thorben Janssen ..read more
Visit website
How to implement a soft delete with Hibernate
Thoughts on Java
by Thorben Janssen
1M ago
The post How to implement a soft delete with Hibernate appeared first on Thorben Janssen. In some applications, you don’t want to or are not allowed to remove a record from the database permanently. But you still need to remove or hide records which are no longer active. One example could be a user account you want to keep because it is linked to other business objects that are still... The post How to implement a soft delete with Hibernate appeared first on Thorben Janssen ..read more
Visit website
11 JPA and Hibernate query hints every developer should know
Thoughts on Java
by Thorben Janssen
1M ago
The post 11 JPA and Hibernate query hints every developer should know appeared first on Thorben Janssen. JPA and Hibernate support a set of hints that you can use to provide additional information to your persistence provider to influence the execution of a query. You can use them for lots of different things, like setting a timeout for your query, using an entity graph, or defining the caching of a query result.... The post 11 JPA and Hibernate query hints every developer should know appeared first on Thorben Janssen ..read more
Visit website
Inheritance Strategies with JPA and Hibernate – The Complete Guide
Thoughts on Java
by Thorben Janssen
1M ago
The post Inheritance Strategies with JPA and Hibernate – The Complete Guide appeared first on Thorben Janssen. Inheritance is one of the key concepts in Java. So, it’s no surprise that most developers want to use it in their domain model. Unfortunately, the relational table model doesn’t know this concept. So, Hibernate, or any other JPA implementation, has to apply a mapping strategy to map your inheritance hierarchy to one or more... The post Inheritance Strategies with JPA and Hibernate – The Complete Guide appeared first on Thorben Janssen ..read more
Visit website
8 things you need to know when migrating to Hibernate 6.x
Thoughts on Java
by Thorben Janssen
1y ago
The post 8 things you need to know when migrating to Hibernate 6.x appeared first on Thorben Janssen. Hibernate 6 has been released for a while, and the latest Spring Data JPA version includes it as a dependency. So, it’s no surprise that… The post 8 things you need to know when migrating to Hibernate 6.x appeared first on Thorben Janssen ..read more
Visit website
Think twice before using an object mapping library to get your DTOs
Thoughts on Java
by Thorben Janssen
1y ago
The post Think twice before using an object mapping library to get your DTOs appeared first on Thorben Janssen. I often get asked if I can recommend any object mapping library to map entity objects to DTOs. And you can find several discussions and… The post Think twice before using an object mapping library to get your DTOs appeared first on Thorben Janssen ..read more
Visit website
How to map composite column types with Hibernate
Thoughts on Java
by Thorben Janssen
1y ago
The post How to map composite column types with Hibernate appeared first on Thorben Janssen. When most developers design their table and entity models, they create tables that only use basic column types and map these to basic entity attributes.… The post How to map composite column types with Hibernate appeared first on Thorben Janssen ..read more
Visit website
Using Window Functions with Hibernate 5 & 6
Thoughts on Java
by Thorben Janssen
1y ago
The post Using Window Functions with Hibernate 5 & 6 appeared first on Thorben Janssen. SQL is an incredibly powerful query language. It provides sheer endless possibilities to extract and transform information. One example of that is a window function.… The post Using Window Functions with Hibernate 5 & 6 appeared first on Thorben Janssen ..read more
Visit website
Spring Data JPA – How to create a custom base repository
Thoughts on Java
by Thorben Janssen
1y ago
The post Spring Data JPA – How to create a custom base repository appeared first on Thorben Janssen. Most developers create their own repositories by adding their queries to one of Spring Data JPA’s standard base repositories, like the JpaRepository or the CrudRepository. These repositories give… The post Spring Data JPA – How to create a custom base repository appeared first on Thorben Janssen ..read more
Visit website

Follow Thoughts on Java on FeedSpot

Continue with Google
Continue with Apple
OR