Scriptico

Hibernate One-to-One Bi-Directional Mapping

In the following article, I would like to show an approach how to map one-to-one bi-directionall two entities in Hibernate.
First of all, let’s take a look at the relation between two tables in a database:

tables

As you can see, there is the one-to-one relation between user and user_profile tables and the user_profile table has a primary key that in fact, it is a foreign key to the id property of the user table. In other words, there is a simple use-case: one user record can have only one related user_profile record.

What the mapping looks like?

There are two classes. Read the rest of this entry »

Apache FOP. embed-url and the classpath resource

Fortunately, I opened for myself incredible Apache FOP. So, I did few templates and faced up a problem to specified a path of the resource for the embed-url parameter in the following part of the apache fop config:

	
		
			
		
	

Read the rest of this entry »