< Prev
Next >



Hibernate Mapping Unsorted Set - HashSet



Today we are going to understand how to persist a collection object based on Set collection interface i.e. HashSet, within the database using Hibernate. HashSet stores the collection of elements in an unsorted order.




Why do we have to add a collection object in an Entity class.


Let's suppose we have a class Companies containing the information such as - id, name and a Set collection of String object(representing names of all the employees of a particular company).
That's why we are going to need a collection object in Companies class, representing multiple employee names in a company.

Let's put this example to work and make it easier for you to understand the whole concept.




Note :


Please subscribe our social media channels for notifications, we post a new article everyday.

Decodejava Google+ Page Decodejava Facebook Page  DecodeJava Twitter Page

Coming Next
-
C++ and Python

Ad2