Tag: web technology

Questions Related to web technology

Which statement is correct ?

  1. Session.contains() method to determine if an instance belongs to the session cache.

  2. Session.contains() method to determine if an instance belongs to the data base

  3. Both are correct

  4. None of the above


Correct Option: A
Explanation:

To solve this question, the user needs to have knowledge about the Session object in Hibernate.

The Session.contains() method is used to check if a particular object is associated with the current Hibernate session or not.

Option A is correct because the Session.contains() method is used to determine if an instance belongs to the session cache.

Option B is incorrect because the Session.contains() method does not determine if an instance belongs to the database. Instead, it checks whether the instance is associated with the current Hibernate session or not.

Option C is incorrect because only option A is correct.

Option D is incorrect because option A is the correct answer.

Therefore,

The Answer is: A.

  1. remove the object and its collections from the first level cache

  2. remove the object and its collections from the second level cache

  3. remove the object and its collections from the data base

  4. None of the above


Correct Option: A
  1. TRUE

  2. FALSE

  3. No matter

  4. None of the above


Correct Option: B

How can you make a property be read from the database but not modified in anyway

  1. By using the insert="false" and update="false" attributes.

  2. By using the isinsert="false" and isupdate="false" attributes

  3. By using the isinsert="no" and isupdate="no" attributes

  4. None


Correct Option: A
  1. A Session will not obtain a JDBC Connection (or a Datasource) unless it is needed

  2. A Session will obtain a JDBC Connection (or a Datasource) on object create

  3. A Session has no relation with JDBC Connection (or a Datasource)

  4. none of the above


Correct Option: A

How to enable query cache in hibernate

  1. hibernate.cache.query_cache true

  2. hibernate.cache.use_query_cache true

  3. hibernate.cache.query_cache yes

  4. none


Correct Option: B
  1. bag has index column

  2. bag permits duplicate element values

  3. bag does not permits duplicate element values

  4. None


Correct Option: B
  1. ListResultSet

  2. ResultSet

  3. ScrollableResultSet

  4. ScrollableResult


Correct Option: D
Explanation:

To understand what session.createQuery("Query").scroll() returns, the user needs to know about Hibernate and its query methods.

Hibernate is an ORM (Object-Relational Mapping) library that provides an interface between Java classes and SQL databases. It provides several query methods to interact with the database, including session.createQuery().

session.createQuery("Query").scroll() method is used to iterate over a large number of objects without loading them all into memory at once. It returns a ScrollableResults object that can be used to scroll through the results one at a time.

Now, let's go through each option and explain why it is right or wrong:

A. ListResultSet: This option is incorrect because there is no such class as ListResultSet in Hibernate.

B. ResultSet: This option is incorrect because session.createQuery("Query").scroll() does not return a ResultSet object. Hibernate uses a different interface called ScrollableResults for scrolling through large datasets.

C. ScrollableResultSet: This option is incorrect because there is no such class as ScrollableResultSet in Hibernate.

D. ScrollableResult: This option is correct. session.createQuery("Query").scroll() returns a ScrollableResult object that can be used to scroll through the results one at a time.

Therefore, the answer is: D. ScrollableResult.