Set
provides an unordered data structure, and duplicate elements are not allowed. Some classes implemented by the Set
interface are java.util.HashSet
, java.util.LinkedHashSet
, and so on. For this recipe, we will use the java.util.HashSet
class, which implements the java.util.Set
interface. The only difference between List
and Set
is that Set
doesn't allow duplicate values. For example, in our previous example, we added the e-mail address with [email protected]
twice, and hibernate will allow us to do this. But in case of Set
, you cannot add a duplicate value. Let's take a look at how to achieve this.

Java Hibernate Cookbook
By :

Java Hibernate Cookbook
By:
Overview of this book
This book will provide a useful hands-on guide to Hibernate to accomplish the development of a real-time Hibernate application.
We will start with the basics of Hibernate, which include setting up Hibernate – the pre-requisites and multiple ways of configuring Hibernate using Java. We will then dive deep into the fundamentals of Hibernate such as SessionFactory, session, criteria, working with objects and criteria. This will help a developer have a better understanding of how Hibernate works and what needs to be done to run a Hibernate application. Moving on, we will learn how to work with annotations, associations and collections. In the final chapters, we will see explore querying, advanced Hibernate concepts and integration with other frameworks.
Table of Contents (15 chapters)
Java Hibernate Cookbook
Credits
About the Authors
About the Reviewers
www.PacktPub.com
Preface
Setting Up Hibernate
Understanding the Fundamentals
Basic Annotations
Working with Collections
Working with Associations
Querying
Advanced Concepts
Integration with Other Frameworks
Index
Customer Reviews