In Hibernate, we can use one of the following options to retrieve objects from database:
- Identifier: We can use load() or get() method and pass the identifier like primary key to fetch an object from database.
- HQL: We can create a HQL query and get the object after executing the query.
- Criteria API: We can use Criteria API to create the search conditions for getting the objects from database.
- Native SQL: We can write native SQL query for a database and just execute it to get the data we want and convert it into desired object.