It's time to continue articles about Hibernate. The last one was dedicated to unidirectional @OneToOne association. So today I will show you how to obtain a bidirectional @OneToOne primary key association. An example from this tutorial is based on the previous article. Let's get started.
Tag Archives MySQL
Today I want to show you an example of unidirectional one to one association using primary key. It can be a little bit difficult for beginners to setup such association but I will try my best to explain all aspects in a clear way. For this tutorial I choose MySQL as a database, also I will use Hibernate and JPA annotations.
As a continuation of the previous article, I want to demonstrate a simple example of Hibernate usage. I will show you the basic principles of Hibernate functionality. The article will cover annotation based configurations. For the tutorial you need to have installed an IDE (e.g. Eclipse), Maven, m2e plugin, MySQL.
When I talk about SQL databases, I always mean a set of tables with some relations between them. Relations in the databases are possible due to foreign keys. In the post I'm going to make a quick overview of the set up of foreign keys in MySQL using Toad MySQL. MySQL has strict standards, so Toad MySQL shouldn't create many restrictions for porting the steps to any other MySQL development tool.