Search This Blog

Tuesday, 15 November 2011

Uni Directional Collections

In this example I created the relation between shelf and book and set the direction of relation from Book to Shelf. i.e. the Book is aware of the shelf. Which is the same case as the db schema. The foreign key is in the Book table and not vice-versa.

Saturday, 12 November 2011

Collections: Entities vs Values

We have seen that Hibernate supports both collection of Entities and collection of values / components. Here is a short summary of the points of note when working with the two.

Wednesday, 9 November 2011

Creating A Custom Id Generator

We have already seen the different identifier generators supported by Hibernate. However this does not constrain us to use these generators only. Hibernate very magnanimously allows us to create our own custom generator.

Sunday, 6 November 2011

Deleting from Collections

In the previous examples I created and used collections that represented simple value elements or components. However one thing that I wanted to try is deleting from collections. Removing the value from the collection for a session bound

Thursday, 3 November 2011

Collections of Components

Earlier I created varied collections using the Java String class. In this example I will replace that with a Component class.
public class Chocolate {
    private String name;
    private String brand;