Which of the following are tags of hibernate.cfg.xml?
-
mapping file
-
mapping-file
-
session-factory
-
session
In hibernate.cfg.xml, the session-factory tag is the root element that contains all Hibernate configuration including database connection properties, mapping resources, and cache settings. The mapping resource is specified using nested tags inside session-factory, not as standalone tags like 'mapping file' or 'mapping-file'.
To answer this question, let's go through each option to understand why it is correct or incorrect:
Option A) mapping file - This option is incorrect because it is not a valid tag in hibernate.cfg.xml.
Option B) mapping-file - This option is incorrect because it is not a valid tag in hibernate.cfg.xml.
Option C) session-factory - This option is correct because `` is a valid tag in hibernate.cfg.xml. It is used to configure the session factory, which is responsible for creating sessions to interact with the database.
Option D) session - This option is incorrect because it is not a valid tag in hibernate.cfg.xml.
The correct answer is C) session-factory. This option is correct because `` is a valid tag in hibernate.cfg.xml.