Tag Archives JPA

Hibernate-logo Recently I've worked on a part of project where are a lot of entities. As in many other projects with the same feature there was implemented "soft delete" approach. That's mean that when someone deletes any entity it remains in a database but a special field (e.g. 'isDeleted') changes its value to true.

Spring-Data Development of web-applications with the help of Spring MVC implies creation of several logical layers of architecture. One of the layers is a DAO (Repository) layer. It is responsible for communication with a database. If you developed the DAO layer at least once, you should know that it involves a lot of boilerplate code. A Spring Data take a part of the routine job related to the DAO on itself.

There are a lot of articles about Hibernate associations in the internet and particularly on my blog. But JPA provides numerous combinations of associations, so it's not strange that we still see new posts about this or that kind of association. Today I want to examine situation with the @JoinTable annotation and intermediary table. For the tutorial I'll use MySQL, Hibernate as implementation of JPA and Maven.

One of goals the in programming is representation of models from the real world. Very often an application needs to model some relationship between entities. In the last article about Hibernate associations I described the rules of setting up a "one to one" relationship. Today I'm going to show you how to setup a bidirectional "one to many" and "many to one" association. This example will be based on previous Hibernate tutorials.