Posty

Wyświetlanie postów z styczeń, 2020

Hibernate 3# - Session API

Hibernate's Session is the interface that provides API for Java application to interact with persistence layer. It introduces CRUD methods to operate on entities. It also contains methods used to handle transactions. We can say, that Session  is the core interface in the Hibernate library. We will have a look at the core features of Session and how it is handled in Spring framework. Entity Management You will often see additional layers of abstraction over Session interface (like in Spring, which is discussed later). However, in this part of the article I will show some basic examples of using  Session object directly with regard to operations on entities. Entity is a domain model class. Its instance represents in the Java world a database row. As an entity example we will use following class: As you can see we are using multiple annotations which are needed by Hibernate to properly map the entity instance to a database row and vice versa. This annotations ...