Implementing a custom component sometimes means querying the database in the component service class. This article wants to give you an introduction on how to retrieve the hibernate session in the component service and how to use Hibernate efficiently to query the database.