Multiple choice technology web technology

Which of the following are tags of hibernate.cfg.xml?

  1. mapping file

  2. mapping-file

  3. session-factory

  4. session

Reveal answer Fill a bubble to check yourself
C Correct answer
Explanation

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'.

AI explanation

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.